home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / X11 / config / Imake.rules < prev    next >
Text File  |  2006-04-12  |  115KB  |  3,632 lines

  1. XCOMM ---------------------------------------------------------------------
  2. XCOMM Imake rules for building libraries, programs, scripts, and data files
  3. XCOMM rules:  $Xorg: Imake.rules,v 1.3 2000/08/17 19:41:46 cpqbld Exp $
  4. XCOMM rules:  $XdotOrg: xc/config/cf/Imake.rules,v 1.6 2004/08/13 17:21:43 krh Exp $
  5. XCOMM
  6. XCOMM
  7. XCOMM
  8. XCOMM
  9. XCOMM rules:  $XFree86: xc/config/cf/Imake.rules,v 3.128 2003/11/15 03:25:17 dawes Exp $
  10.  
  11. /*
  12.  *           MACHINE-INDEPENDENT RULES; DO NOT MODIFY
  13.  *
  14.  * Warning, when defining rules: make sure you do not include both a trailing
  15.  * backslash and double ampersand backslash or else you will get an extra
  16.  * backslash in the Makefile.
  17.  *
  18.  * The following macros are defined for the various templates and Imakefiles
  19.  * (for a list of the applicable make variables, see the template files):
  20.  *
  21.  * Concat            (a,b)
  22.  * Concat3            (a,b,c)
  23.  * Concat4            (a,b,c,d)
  24.  * _Use                (a,b)
  25.  * _UseCat            (a,b,c)
  26.  * _MUse            (a,b)
  27.  * _MUseCat            (a,b,c)
  28.  * ProgramTargetName        (target)
  29.  * HostProgramTargetName    (target)
  30.  * RunProgram            (progvar,options)
  31.  * RunProgramWithSetup        (setup,progvar,options)
  32.  * RemoveFile            (file)
  33.  * RemoveFiles            (files)
  34.  * CenterLoadTarget        (target,srclist,libs,defines)
  35.  * CenterProgramTarget        (program,srclist,objlist,locallibs,syslibs)
  36.  * SentinelLinkTarget        (step,program,linklist)
  37.  * SentinelProgramTarget    (program,deplist,linklist)
  38.  * SentinelCplusplusProgramTarget    (program,deplist,linklist)
  39.  * PurifyLinkTarget        (step,program,linklist)
  40.  * PurifyProgramTarget        (program,deplist,linklist)
  41.  * PurifyCplusplusProgramTarget    (program,deplist,linklist)
  42.  * ProofLinkTarget        (step,program,linklist)
  43.  * ProofProgramTarget        (program,deplist,linklist)
  44.  * ProofCplusplusProgramTarget    (program,deplist,linklist)
  45.  * ProofCleanTarget        ()
  46.  * RemoveTargetProgram        (program)
  47.  * MakeDir            (dir)
  48.  * InstallDirectory        (dir)
  49.  * BuildIncludesTop        (srclist)
  50.  * BuildIncludes        (srclist,dstsubdir,dstupdir)
  51.  * LinkRule            (program,options,objects,libraries)
  52.  * HostLinkRule            (program,options,objects,libraries)
  53.  * NoCmpScript            (target)
  54.  * NoConfigRec            (target)
  55.  * NormalProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  56.  * SetUIDProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  57.  * SingleProgramTarget        (program,objects,locallibs,syslibs)
  58.  * SimpleProgramTarget        (program)
  59.  * ComplexProgramTarget        (program)
  60.  * ComplexProgramTarget_1    (program,locallib,syslib)
  61.  * ComplexProgramTarget_2    (program,locallib,syslib)
  62.  * ComplexProgramTarget_3    (program,locallib,syslib)
  63.  * ServerTargetWithFlags    (server,subdirs,objects,libs,syslibs,flags)
  64.  * ServerTarget            (server,subdirs,objects,libs,syslibs)
  65.  * MoveToBakFile        (file)
  66.  * RMoveToBakFile        (file)
  67.  * RanLibrary            (args)
  68.  * LibraryTargetName        (libname)
  69.  * LibraryTargetNameSuffix    (libname,suffix)
  70.  * InstallNamedTarget        (step,srcname,flags,dest,dstname)
  71.  * InstallTarget        (step,file,flags,dest)
  72.  * InstallLibrary        (libname,dest)
  73.  * MergeIntoInstalledLibrary    (tolib,fromlib)
  74.  * InstallLibraryAlias        (libname,alias,dest)
  75.  * InstallLintLibrary        (libname,dest)
  76.  * InstallManPageLong        (file,destdir,dest)
  77.  * InstallManPage        (file,destdir)
  78.  * InstallManPageAliases    (file,destdir,aliases)
  79.  * ManKeywordsTarget        (manpath)
  80.  * InstallNamedNonExec        (srcname,dstname,dest)
  81.  * InstallNonExecFile        (file,dest)
  82.  * InstallNonExecFileNoClobber    (file,dest)
  83.  * InstallNonExec        (file,dest)
  84.  * InstallProgramWithFlags    (program,dest,flags)
  85.  * InstallProgram        (program,dest)
  86.  * InstallScript        (program,dest)
  87.  * InstallNamedProg        (srcname,dstname,dest)
  88.  * InstallNamedProgNoClobber    (srcname,dstname,dest)
  89.  * MakeFlagsToShellFlags    (makeflags,shellcmd)
  90.  * MakeNamedTargetSubdir    (dir,flags,subname)
  91.  * LinkConfDirectoryLong    (mdir,cdir,rdir,ldir,opath,npath)
  92.  * LinkConfDirectory        (mdir,cdir,rdir,ldir)
  93.  * LinkConfFileLong        (cfile,lfile,opath,npath)
  94.  * LinkConfFile            (cfile,lfile)
  95.  * LinkFileList            (step,list,dir,sub)
  96.  * LinkVarDirectory        (mdir,cdir,rdir,ldir)
  97.  * InstallMultipleDestFlags    (step,list,dest,flags)
  98.  * InstallMultipleDest        (step,list,dest)
  99.  * InstallMultiple        (list,dest)
  100.  * InstallMultipleFlags        (list,dest,flags)
  101.  * InstallMultipleMan        (list,dest)
  102.  * InstallMultipleManSuffix    (list,dest,suffix)
  103.  * DependDependency        ()
  104.  * DependTarget            ()
  105.  * DependTarget3        (srcs1,srcs2,srcs3)
  106.  * CleanTarget            ()
  107.  * TagsTarget            ()
  108.  * ImakeDependency        (target)
  109.  * BuildMakefileTarget        (notused,imakeflags)
  110.  * MakefileTarget        ()
  111.  * LibMkdir            (dir)
  112.  * LibCleanDir            (dir)
  113.  * LintLibReferences        (varname,libname,libsource)
  114.  * UnsharedLibReferences    (varname,libname,libsource)
  115.  * ProjectUnsharedLibReferences    (varname,libname,libsource,buildlibdir)
  116.  * SharedLibDependencies    (libname,libsource,revname)
  117.  * SharedDSLibDependencies    (libname,libsource,revname)
  118.  * SharedLibReferences        (varname,libname,libsource,revname,rev)
  119.  * SharedDSLibReferences    (varname,libname,libsource,revname,rev)
  120.  * ObjectCompile        (options)
  121.  * NormalLibObjCompile        (options)
  122.  * NormalSharedLibObjCompile    (options)
  123.  * NormalRelocLibObjCompile    (options)
  124.  * LibObjCompile        (dir,options)
  125.  * DebuggedLibObjCompile    (options)
  126.  * ProfiledLibObjCompile    (options)
  127.  * SharedLibObjCompile        (options)
  128.  * NormalLibraryObjectRule    ()
  129.  * NormalFortranObjectRule    ()
  130.  * ObjectFromSpecialSource    (dst,src,flags)
  131.  * SpecialObjectRule        (objs,depends,options)
  132.  * SpecialCObjectRule        (basename,depends,options)
  133.  * LexFile            (file)
  134.  * M4File            (file,includes)
  135.  * YaccFile            (file,flags)
  136.  * YaccFileNoFlags        (file)
  137.  * MakeLibrary            (libname,objlist)
  138.  * LinkBuildLibrary        (lib)
  139.  * LinkBuildSonameLibrary    (lib)
  140.  * NormalLibraryTarget        (libname,objlist)
  141.  * NormalLibraryTarget2        (libname,objlist1,objlist2)
  142.  * NormalLibraryTarget3        (libname,objlist1,objlist2,objlist3)
  143.  * NormalDepLibraryTarget    (libname,deplist,objlist)
  144.  * UnsharedLibraryTarget    (libname,objlist,down,up)
  145.  * UnsharedLibraryTarget3    (libname,objlist1,objlist2,objlist3,down,up)
  146.  * SubdirLibraryRule        (objlist)
  147.  * ProfiledLibraryTarget    (libname,objlist)
  148.  * DebuggedLibraryTarget    (libname,objlist)
  149.  * AliasedLibraryTarget        (libname,alias)
  150.  * NormalRelocatableTarget    (objname,objlist)
  151.  * ProfiledRelocatableTarget    (objname,objlist)
  152.  * DebuggedRelocatableTarget    (objname,objlist)
  153.  * LintLibraryTarget        (libname,srclist)
  154.  * NormalLintTarget        (srclist)
  155.  * LintTarget            ()
  156.  * LinkSourceFile        (src,dir)
  157.  * LinkFile            (tofile,fromfile)
  158.  * MakeSubincludesForBuild    (step,dir,srclist)
  159.  * LangNamedTargetSubdirs    (lang,name,dirs,verb,flags,subname)
  160.  * LangNamedMakeSubdirs        (lang,name,dirs)
  161.  * LangMakeSubdirs        (lang,dirs)
  162.  * NamedTargetSubdirs        (name,dirs,verb,flags,subname)
  163.  * NamedMakeSubdirs        (name,dirs)
  164.  * MakeSubdirs            (dirs)
  165.  * DependSubdirs        (dirs)
  166.  * ForceSubdirs            (dirs)
  167.  * InstallSubdirs        (dirs)
  168.  * InstallManSubdirs        (dirs)
  169.  * IncludesSubdirs        (dirs)
  170.  * NamedCleanSubdirs        (name,dirs)
  171.  * CleanSubdirs            (dirs)
  172.  * NamedTagSubdirs        (name,dirs)
  173.  * TagSubdirs            (dirs)
  174.  * MakeLintSubdirs        (dirs,target,subtarget)
  175.  * LintSubdirs            (dirs)
  176.  * MakeLintLibSubdirs        (dirs)
  177.  * MakeMakeSubdirs        (dirs,target)
  178.  * MakefileSubdirs        (dirs)
  179.  * CppScriptTarget        (dst,src,defs,deplist)
  180.  * MakeScriptFromCpp        (name,defs)
  181.  * CppFileTarget        (dst,src,defs,deplist)
  182.  * CppSourceFile        (dst,src,defs,deplist)
  183.  * MakeDirectories        (step,dirs)
  184.  * AllTarget            (depends)
  185.  * StaticLibrary        (libpath,libname)
  186.  * MakeMutex            (targets)
  187.  * LinkBuildModule        (module,subdir)
  188.  * LinkBuildNamedModule        (module,name,subdir)
  189.  * DynamicModuleTarget        (module,modlist)
  190.  * InstallDynamicModule        (module,dest,subdir)
  191.  * InstallDynamicNamedModule    (module,instname,dest,subdir)
  192.  * LinkerRuntimeLibraryPathFlag    (path)
  193.  *
  194.  *
  195.  * The following are in specific <os>Lib.rules:
  196.  *
  197.  * SharedLibraryTarget        (libname,rev,solist,down,up)
  198.  * SharedLibraryDataTarget    (libname,rev,salist)
  199.  * InstallSharedLibrary        (libname,rev,dest)
  200.  * InstallSharedLibraryData    (libname,rev,dest)
  201.  * SharedDepModuleTarget    (name,deps,solist)
  202.  *
  203.  */
  204.  
  205. #define NullParameter
  206.  
  207. /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
  208. #ifndef DirFailPrefix
  209. #define DirFailPrefix
  210. #endif
  211.  
  212. /*
  213.  * NoCmpScript - suppress clearmake build script comparison.
  214.  */
  215. #ifndef NoCmpScript
  216. #if HasClearmake
  217. #define NoCmpScript(targ)                        @@\
  218. XCOMM special target for clearmake                    @@\
  219. .NO_CMP_SCRIPT: targ
  220. #else
  221. #define NoCmpScript(targ) /**/
  222. #endif
  223. #endif
  224.  
  225. /*
  226.  * NoConfigRec - suppress using clearmake configuration records.
  227.  */
  228. #ifndef NoConfigRec
  229. #if HasClearmake
  230. #define NoConfigRec(targ)                        @@\
  231. XCOMM special target for clearmake                    @@\
  232. .NO_CONFIG_REC: targ
  233. #else
  234. #define NoConfigRec(targ) /**/
  235. #endif
  236. #endif
  237.  
  238. /*
  239.  * Concat - concatenates two strings.
  240.  */
  241. #ifndef Concat
  242. #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
  243. #define Concat(a,b)a##b
  244. #else
  245. #define Concat(a,b)a/**/b
  246. #endif
  247. #endif
  248.  
  249. /*
  250.  * Concat3 - concatenates three strings.
  251.  */
  252. #ifndef Concat3
  253. #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
  254. #define Concat3(a,b,c)a##b##c
  255. #else
  256. #define Concat3(a,b,c)a/**/b/**/c
  257. #endif
  258. #endif
  259.  
  260. /*
  261.  * Concat4 - concatenates four strings.
  262.  */
  263. #ifndef Concat4
  264. #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
  265. #define Concat4(a,b,c,d)a##b##c##d
  266. #else
  267. #define Concat4(a,b,c,d)a/**/b/**/c/**/d
  268. #endif
  269. #endif
  270.  
  271. /*
  272.  * _XUse - makes a choice based on UseInstalledX11.
  273.  */
  274. #ifndef _XUse
  275. # if defined(UseInstalled) || UseInstalledX11
  276. #  define _XUse(a,b) a
  277. # else
  278. #  define _XUse(a,b) b
  279. # endif
  280. #endif /* _XUse */
  281.  
  282. /*
  283.  * _Use - makes a choice based on UseInstalled.
  284.  */
  285. #ifndef _Use
  286. # define _Use    _XUse
  287. #endif /* _Use */
  288.  
  289. /*
  290.  * _XUseCat - combination of _XUse and Concat.
  291.  *           exists to avoid problems with some preprocessors
  292.  */
  293. #ifndef _XUseCat
  294. # if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
  295. #  if defined(UseInstalled) || UseInstalledX11
  296. #   define _XUseCat(a,b,c) a##c
  297. #  else
  298. #   define _XUseCat(a,b,c) b##c
  299. #  endif
  300. # else
  301. #  if defined(UseInstalled) || UseInstalledX11
  302. #   define _XUseCat(a,b,c) a/**/c
  303. #  else
  304. #   define _XUseCat(a,b,c) b/**/c
  305. #  endif
  306. # endif
  307. #endif /* _XUseCat */
  308.  
  309. /*
  310.  * _UseCat - combination of _Use and Concat.
  311.  *           exists to avoid problems with some preprocessors
  312.  */
  313. #ifndef _UseCat
  314. # define _UseCat    _XUseCat
  315. #endif /* _UseCat */
  316.  
  317. #ifndef ProgramTargetName
  318. #define ProgramTargetName(target)target
  319. #endif
  320.  
  321. #ifndef HostProgramTargetName
  322. #define HostProgramTargetName(target)target
  323. #endif
  324.  
  325. #ifndef RunProgram
  326. #define RunProgram(progvar,options) $(progvar) options
  327. #endif
  328.  
  329. #ifndef RunProgramWithSetup
  330. #define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options
  331. #endif
  332.  
  333. #ifndef RunPerlScript
  334. #define RunPerlScript(script,options) $(PERLENVSETUP) $(PERL) $(PERLOPTS) script options
  335. #endif
  336.  
  337. #ifndef RemoveFile
  338. #define RemoveFile(file) $(RM) file
  339. #endif /* RemoveFile */
  340.  
  341. #ifndef RemoveFiles
  342. #define RemoveFiles(files) $(RM) files
  343. #endif /* RemoveFiles */
  344.  
  345. #if RemoveObsoleteFiles
  346. #define RemoveOldFile(new,old,dir)                    @@\
  347.     @if [ -f new ]; then set -x; \                    @@\
  348.         RemoveFile($(DESTDIR)dir/old); \            @@\
  349.     fi
  350. #else
  351. #define RemoveOldFile(new,old,dir) $(_NULLCMD_)
  352. #endif
  353.  
  354. /*
  355.  * CenterLoadTarget - generate rules to load files into CodeCenter
  356.  */
  357. #ifndef CenterLoadTarget
  358. #if HasCodeCenter
  359. #define CenterLoadTarget(target,srclist,libs,defines)            @@\
  360. ProgramTargetName(target):: srclist                    @@\
  361.     XCOMM load defines srclist libs
  362. #else
  363. #define CenterLoadTarget(target,srclist,libs,defines) /**/
  364. #endif
  365. #endif /* CenterLoadTarget */
  366.  
  367. /*
  368.  * CenterProgramTarget - generate rules to make CodeCenter read in sources
  369.  * and objects.
  370.  */
  371. #ifndef CenterProgramTarget
  372. #define CenterProgramTarget(program,srclist,objlist,locallibs,syslibs)    @@\
  373. CenterLoadTarget(Concat(debug_,program),srclist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) @@\
  374.                                     @@\
  375. CenterLoadTarget(Concat(odebug_,program),objlist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES))
  376. #endif /* CenterProgramTarget */
  377.  
  378. #ifndef SentinelLinkTarget
  379. #if HasSentinel
  380. #define SentinelLinkTarget(step,program,linklist)            @@\
  381. ProgramTargetName(step.sentinel):                    @@\
  382.     RemoveTargetProgram($@)                        @@\
  383.     $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o program.sentinel $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
  384. #else
  385. #define SentinelLinkTarget(step,program,linklist) /**/
  386. #endif
  387. #endif /* SentinelLinkTarget */
  388.  
  389. /*
  390.  * SentinelProgramTarget - generate rules to make Sentinel image
  391.  */
  392. #ifndef SentinelProgramTarget
  393. #if HasSentinel
  394. #define    SentinelProgramTarget(program,deplist,linklist)            @@\
  395. ProgramTargetName(program.sentinel): deplist                @@\
  396.     RemoveTargetProgram($@)                        @@\
  397.     $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  398.                                     @@\
  399. clean clean.sentinel::                            @@\
  400.     RemoveFile(program.sentinel)
  401. #else
  402. #define    SentinelProgramTarget(program,deplist,linklist) /**/
  403. #endif
  404. #endif /* SentinelProgramTarget */
  405.  
  406. /*
  407.  * SentinelCplusplusProgramTarget - generate rules to make Sentinel image
  408.  */
  409. #ifndef SentinelCplusplusProgramTarget
  410. #if HasSentinel
  411. #define    SentinelCplusplusProgramTarget(program,deplist,linklist)    @@\
  412. ProgramTargetName(program.sentinel): deplist                @@\
  413.     RemoveTargetProgram($@)                        @@\
  414.     $(CXXENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  415.                                     @@\
  416. clean clean.sentinel::                            @@\
  417.     RemoveFile(program.sentinel)
  418. #else
  419. #define    SentinelCplusplusProgramTarget(program,deplist,linklist) /**/
  420. #endif
  421. #endif /* SentinelCplusplusProgramTarget */
  422.  
  423. #ifndef PurifyLinkTarget
  424. #if HasPurify
  425. #define PurifyLinkTarget(step,program,linklist)                @@\
  426. ProgramTargetName(step.pure):                        @@\
  427.     RemoveTargetProgram($@)                        @@\
  428.     $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o program.pure $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
  429. #else
  430. #define PurifyLinkTarget(step,program,linklist) /**/
  431. #endif
  432. #endif /* PurifyLinkTarget */
  433.  
  434. /*
  435.  * PurifyProgramTarget - generate rules to make Purify'ed image
  436.  */
  437. #ifndef PurifyProgramTarget
  438. #if HasPurify
  439. #define    PurifyProgramTarget(program,deplist,linklist)            @@\
  440. ProgramTargetName(program.pure): deplist                @@\
  441.     RemoveTargetProgram($@)                        @@\
  442.     $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  443.                                     @@\
  444. clean clean.pure::                            @@\
  445.     RemoveFile(program.pure)
  446. #else
  447. #define    PurifyProgramTarget(program,deplist,linklist) /**/
  448. #endif
  449. #endif /* PurifyProgramTarget */
  450.  
  451. /*
  452.  * PurifyCplusplusProgramTarget - generate rules to make Purify'ed image
  453.  */
  454. #ifndef PurifyCplusplusProgramTarget
  455. #if HasPurify
  456. #define    PurifyCplusplusProgramTarget(program,deplist,linklist)        @@\
  457. ProgramTargetName(program.pure): deplist                @@\
  458.     RemoveTargetProgram($@)                        @@\
  459.     $(CXXENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  460.                                     @@\
  461. clean clean.pure::                            @@\
  462.     RemoveFile(program.pure)
  463. #else
  464. #define    PurifyCplusplusProgramTarget(program,deplist,linklist) /**/
  465. #endif
  466. #endif /* PurifyCplusplusProgramTarget */
  467.  
  468. #ifndef ProofLinkTarget
  469. #if HasTestCenter
  470. #define ProofLinkTarget(step,program,linklist)                @@\
  471. ProgramTargetName(step.tc):                        @@\
  472.     RemoveTargetProgram($@)                        @@\
  473.     $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o program.tc $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
  474. #else
  475. #define ProofLinkTarget(step,program,linklist) /**/
  476. #endif
  477. #endif /* ProofLinkTarget */
  478.  
  479. /*
  480.  * ProofProgramTarget - generate rules to make Proof'ed image
  481.  */
  482. #ifndef ProofProgramTarget
  483. #if HasTestCenter
  484. #define    ProofProgramTarget(program,deplist,linklist)            @@\
  485. ProgramTargetName(program.tc): deplist                    @@\
  486.     RemoveTargetProgram($@)                        @@\
  487.     $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  488.                                     @@\
  489. clean cleantc::                                @@\
  490.     RemoveFiles(program.tc program.tc.*.*)
  491. #else
  492. #define    ProofProgramTarget(program,deplist,linklist) /**/
  493. #endif
  494. #endif /* ProofProgramTarget */
  495.  
  496. /*
  497.  * ProofCplusplusProgramTarget - generate rules to make Proof'ed image
  498.  */
  499. #ifndef ProofCplusplusProgramTarget
  500. #if HasTestCenter
  501. #define    ProofCplusplusProgramTarget(program,deplist,linklist)        @@\
  502. ProgramTargetName(program.tc): deplist                    @@\
  503.     RemoveTargetProgram($@)                        @@\
  504.     $(CXXENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
  505.                                     @@\
  506. clean cleantc::                                @@\
  507.     RemoveFiles(program.tc program.tc.*.*)
  508. #else
  509. #define    ProofCplusplusProgramTarget(program,deplist,linklist) /**/
  510. #endif
  511. #endif /* ProofCplusplusProgramTarget */
  512.  
  513. #ifndef ProofCleanTarget
  514. #if HasTestCenter
  515. #define ProofCleanTarget()                        @@\
  516. clean cleantc::                                @@\
  517.     $(RM) -r TC.Cache
  518. #else
  519. #define ProofCleanTarget() /**/
  520. #endif
  521. #endif /* ProofCleanTarget */
  522.  
  523. #ifndef RemoveTargetProgram
  524. #if RemoveTargetProgramByMoving
  525. #define RemoveTargetProgram(program) \
  526. -if [ -f program ]; then RemoveFile(Concat(program,~)); $(MV) program Concat(program,~); fi
  527. #else
  528. #define RemoveTargetProgram(program) RemoveFile(program)
  529. #endif
  530. #endif /* RemoveTargetProgram */
  531.  
  532. #ifndef MakeDir
  533. #define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then \        @@\
  534.         set +x; \                        @@\
  535.     else \                                @@\
  536.         if [ -h dir ]; then \                    @@\
  537.             (set -x; rm -f dir); \                @@\
  538.         fi; \                            @@\
  539.         (set -x; $(MKDIRHIER) dir); \                @@\
  540.     fi
  541. #endif /* MakeDir */
  542.  
  543. #ifndef MakeDirInline
  544. #define MakeDirInline(dir) if [ -d dir ]; then \            @@\
  545.         :; \                            @@\
  546.     else \                                @@\
  547.         if [ -h dir ]; then \                    @@\
  548.             (set -x; rm -f dir); \                @@\
  549.         fi; \                            @@\
  550.         (set -x; $(MKDIRHIER) dir); \                @@\
  551.     fi
  552. #endif /* MakeDirInline */
  553.  
  554. #ifndef InstallDirectory
  555. #define InstallDirectory(dir)                        @@\
  556. install::                                @@\
  557.     MakeDir(dir)
  558. #endif /* InstallDirectory */
  559.  
  560. #ifndef InstallCreateLink
  561. # define InstallCreateLink(dest,from,to)                @@\
  562. install:: $(DESTDIR)dest/from                        @@\
  563.       cd $(DESTDIR)dest && \                    @@\
  564.       $(LN) -sf from to
  565. #endif
  566.  
  567. #ifndef BuildIncludesTop
  568. #define BuildIncludesTop(srclist)                    @@\
  569. includes:: srclist                            @@\
  570.     MakeDir($(BUILDINCDIR))                        @@\
  571.     @(set -x; cd $(BUILDINCDIR) && for i in srclist; do \        @@\
  572.         RemoveFile($$i); \                    @@\
  573.         $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$$i .; \        @@\
  574.     done)
  575. #endif /* BuildIncludesTop */
  576.  
  577. #ifndef BuildIncludes
  578. #define BuildIncludes(srclist,dstsubdir,dstupdir)            @@\
  579. includes:: srclist                            @@\
  580.     MakeDir($(BUILDINCDIR)/dstsubdir)                @@\
  581.     @(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \    @@\
  582.         RemoveFile($$i); \                    @@\
  583.         $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \    @@\
  584.     done)
  585. #endif /* BuildIncludes */
  586.  
  587. /*
  588.  * LinkBuildBinary - export a binary from the build tree.
  589.  */
  590. #ifndef LinkBuildBinary
  591. #define LinkBuildBinary(binary)                        @@\
  592. all:: $(BUILDBINDIR)/binary binary                    @@\
  593.                                     @@\
  594. $(BUILDBINDIR)/binary: binary                        @@\
  595.     MakeDir($(BUILDBINDIR))                        @@\
  596.     RemoveFile($@)                            @@\
  597.     cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary .
  598. #endif /* LinkBuildBinary */
  599.  
  600. #ifndef BuildInterfaces
  601. #define BuildInterfaces(srclist,dstsubdir,dstupdir)            @@\
  602. interfaces::                                @@\
  603.     MakeDir($(BUILDINCDIR)/dstsubdir)                @@\
  604.     @(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \    @@\
  605.         RemoveFile($$i); \                    @@\
  606.         $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \    @@\
  607.     done)
  608. #endif /* BuildInterfaces */
  609.  
  610. /*
  611.  * LinkRule - link a program
  612.  */
  613. #ifndef LinkRule
  614. #define LinkRule(program,options,objects,libraries) \
  615. $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
  616. #endif /* LinkRule */
  617.  
  618. /*
  619.  * HostLinkRule - link a utility to be used on the build host
  620.  * (differs from LinkRule if cross compiling)
  621.  */
  622. #ifndef HostLinkRule
  623. #define HostLinkRule LinkRule
  624. #endif
  625.  
  626. #ifndef CplusplusLinkRule
  627. #define CplusplusLinkRule(program,options,objects,libraries) \
  628. $(CXXLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
  629. #endif /* CplusplusLinkRule */
  630.  
  631. /*
  632.  * NormalProgramTarget - generate rules to compile and link the indicated
  633.  * program; since it does not use any default object files, it may be used for
  634.  * multiple programs in the same Imakefile.
  635.  */
  636. #ifndef NormalProgramTarget
  637. #define    NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)    @@\
  638. ProgramTargetName(program): objects deplibs                @@\
  639.     RemoveTargetProgram($@)                        @@\
  640.     LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs)    @@\
  641.                                     @@\
  642. SentinelProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  643. PurifyProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  644. ProofProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  645.                                     @@\
  646. clean::                                    @@\
  647.     RemoveFile(ProgramTargetName(program))
  648. #endif /* NormalProgramTarget */
  649.  
  650.  
  651. /*
  652.  * NormalCplusplusProgramTarget - Like NormalTargetProgram, but uses
  653.  * C++ linking rules.
  654.  */
  655. #ifndef NormalCplusplusProgramTarget
  656. #define    NormalCplusplusProgramTarget(program,objects,deplibs,locallibs,syslibs)    @@\
  657. ProgramTargetName(program): objects deplibs                @@\
  658.     RemoveTargetProgram($@)                        @@\
  659.     CplusplusLinkRule($@,$(CXXLDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
  660.                                     @@\
  661. SentinelCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  662. PurifyCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  663. ProofCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
  664.                                     @@\
  665. clean::                                    @@\
  666.     RemoveFile(ProgramTargetName(program))
  667. #endif /* NormalCplusplusProgramTarget */
  668.  
  669.  
  670. #ifndef SetUIDProgramTarget
  671. #define SetUIDProgramTarget NormalProgramTarget
  672. #endif
  673.  
  674.  
  675. /*
  676.  * SingleProgramTarget - obsolete version of NormalProgramTarget that does
  677.  * not have deplibs.
  678.  */
  679. #ifndef SingleProgramTarget
  680. #define    SingleProgramTarget(program,objects,locallibs,syslibs)        @@\
  681. NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
  682. #endif /* SingleProgramTarget */
  683.  
  684. /*
  685.  * SimpleProgramTarget - generate rules for compiling and linking programs
  686.  * that only have one C source file.  It should only be used in Imakefiles
  687.  * that describe a single program.
  688.  */
  689. #ifndef SimpleProgramTarget
  690. #define    SimpleProgramTarget(program)                    @@\
  691.            OBJS = program.o                        @@\
  692.            SRCS = program.c                        @@\
  693.                                     @@\
  694. ComplexProgramTarget(program)
  695. #endif /* SimpleProgramTarget */
  696.  
  697. #ifndef SimpleProgramTarget_1
  698. #define    SimpleProgramTarget_1(program)                    @@\
  699.            OBJS1 = program.o                        @@\
  700.            SRCS1 = program.c                        @@\
  701.                                     @@\
  702. ComplexProgramTarget_1(program,$(LOCAL_LIBRARIES),NullParameter)
  703. #endif /* SimpleProgramTarget_1 */
  704. #ifndef SimpleProgramTarget_2
  705. #define    SimpleProgramTarget_2(program)                    @@\
  706.            OBJS2 = program.o                        @@\
  707.            SRCS2 = program.c                        @@\
  708.                                     @@\
  709. ComplexProgramTarget_2(program,$(LOCAL_LIBRARIES),NullParameter)
  710. #endif /* SimpleProgramTarget_2 */
  711. #ifndef SimpleProgramTarget_3
  712. #define    SimpleProgramTarget_3(program)                    @@\
  713.            OBJS3 = program.o                        @@\
  714.            SRCS3 = program.c                        @@\
  715.                                     @@\
  716. ComplexProgramTarget_3(program,$(LOCAL_LIBRARIES),NullParameter)
  717. #endif /* SimpleProgramTarget_3 */
  718. #ifndef SimpleProgramTarget_4
  719. #define    SimpleProgramTarget_4(program)                    @@\
  720.            OBJS4 = program.o                        @@\
  721.            SRCS4 = program.c                        @@\
  722.                                     @@\
  723. ComplexProgramTarget_4(program,$(LOCAL_LIBRARIES),NullParameter)
  724. #endif /* SimpleProgramTarget_4 */
  725. #ifndef SimpleProgramTarget_5
  726. #define    SimpleProgramTarget_5(program)                    @@\
  727.            OBJS5 = program.o                        @@\
  728.            SRCS5 = program.c                        @@\
  729.                                     @@\
  730. ComplexProgramTarget_5(program,$(LOCAL_LIBRARIES),NullParameter)
  731. #endif /* SimpleProgramTarget_5 */
  732. #ifndef SimpleProgramTarget_6
  733. #define    SimpleProgramTarget_6(program)                    @@\
  734.            OBJS6 = program.o                        @@\
  735.            SRCS6 = program.c                        @@\
  736.                                     @@\
  737. ComplexProgramTarget_6(program,$(LOCAL_LIBRARIES),NullParameter)
  738. #endif /* SimpleProgramTarget_6 */
  739. #ifndef SimpleProgramTarget_7
  740. #define    SimpleProgramTarget_7(program)                    @@\
  741.            OBJS7 = program.o                        @@\
  742.            SRCS7 = program.c                        @@\
  743.                                     @@\
  744. ComplexProgramTarget_7(program,$(LOCAL_LIBRARIES),NullParameter)
  745. #endif /* SimpleProgramTarget_7 */
  746. #ifndef SimpleProgramTarget_8
  747. #define    SimpleProgramTarget_8(program)                    @@\
  748.            OBJS8 = program.o                        @@\
  749.            SRCS8 = program.c                        @@\
  750.                                     @@\
  751. ComplexProgramTarget_8(program,$(LOCAL_LIBRARIES),NullParameter)
  752. #endif /* SimpleProgramTarget_8 */
  753. #ifndef SimpleProgramTarget_9
  754. #define    SimpleProgramTarget_9(program)                    @@\
  755.            OBJS9 = program.o                        @@\
  756.            SRCS9 = program.c                        @@\
  757.                                     @@\
  758. ComplexProgramTarget_9(program,$(LOCAL_LIBRARIES),NullParameter)
  759. #endif /* SimpleProgramTarget_9 */
  760. #ifndef SimpleProgramTarget_10
  761. #define    SimpleProgramTarget_10(program)                    @@\
  762.            OBJS10 = program.o                        @@\
  763.            SRCS10 = program.c                        @@\
  764.                                     @@\
  765. ComplexProgramTarget_10(program,$(LOCAL_LIBRARIES),NullParameter)
  766. #endif /* SimpleProgramTarget_10 */
  767.  
  768. #ifndef SimpleCplusplusProgramTarget
  769. #define SimpleCplusplusProgramTarget(program)                @@\
  770.            OBJS = program.o                        @@\
  771.            SRCS = program.CCsuf                        @@\
  772.                                     @@\
  773. ComplexCplusplusProgramTarget(program)
  774. #endif /* SimpleCplusplusProgramTarget */
  775.  
  776. #ifndef ProgramTargetHelper
  777. #define    ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib)    @@\
  778. ProgramTargetName(program): $(objs) $(deplib)                @@\
  779.     RemoveTargetProgram($@)                        @@\
  780.     LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib)    @@\
  781.                                     @@\
  782. CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)        @@\
  783. SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  784. PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  785. ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  786.                                     @@\
  787. InstallProgram(program,$(BINDIR))                    @@\
  788. InstallManPage(program,$(MANDIR))
  789. #endif /* ProgramTargetHelper */
  790.  
  791. #ifndef ProgramTargetHelperNoMan
  792. #define ProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\
  793. ProgramTargetName(program): $(objs) $(deplib)                @@\
  794.     RemoveTargetProgram($@)                        @@\
  795.     LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib)    @@\
  796.                                     @@\
  797. CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)        @@\
  798. SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  799. PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  800. ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  801.                                     @@\
  802. InstallProgram(program,$(BINDIR))
  803. #endif /* ProgramTargetHelperNoMan */
  804.  
  805. #ifndef CplusplusProgramTargetHelper
  806. #define    CplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
  807. ProgramTargetName(program): $(objs) $(deplib)                @@\
  808.     RemoveTargetProgram($@)                        @@\
  809.     CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
  810.                                     @@\
  811. CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)        @@\
  812. SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  813. PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  814. ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  815.                                     @@\
  816. InstallProgram(program,$(BINDIR))                    @@\
  817. InstallManPage(program,$(MANDIR))
  818. #endif /* CplusplusProgramTargetHelper */
  819.  
  820. #ifndef CplusplusProgramTargetHelperNoMan
  821. #define    CplusplusProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\
  822. ProgramTargetName(program): $(objs) $(deplib)                @@\
  823.     RemoveTargetProgram($@)                        @@\
  824.     CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
  825.                                     @@\
  826. CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)        @@\
  827. SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  828. PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  829. ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
  830.                                     @@\
  831. InstallProgram(program,$(BINDIR))                    @@
  832. #endif /* CplusplusProgramTargetHelperNoMan */
  833.  
  834. /*
  835.  * ComplexProgramTarget - generate rules for compiling and linking the
  836.  * program specified by $(OBJS) and $(SRCS), installing the program and its
  837.  * man page, and generating dependencies.  It should only be used in
  838.  * Imakefiles that describe a single program.
  839.  */
  840. #ifndef ComplexProgramTarget
  841. #define    ComplexProgramTarget(program)                    @@\
  842.         PROGRAM = ProgramTargetName(program)                @@\
  843.                                     @@\
  844. AllTarget(ProgramTargetName(program))                    @@\
  845.                                     @@\
  846. ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
  847.                                     @@\
  848. DependTarget()                                @@\
  849. LintTarget()                                @@\
  850.                                     @@\
  851. clean::                                    @@\
  852.     RemoveFile(ProgramTargetName(program))
  853. #endif /* ComplexProgramTarget */
  854.  
  855. #ifndef ComplexCplusplusProgramTarget
  856. #define    ComplexCplusplusProgramTarget(program)                @@\
  857.         PROGRAM = ProgramTargetName(program)                @@\
  858.                                     @@\
  859. AllTarget(ProgramTargetName(program))                    @@\
  860.                                     @@\
  861. CplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
  862.                                     @@\
  863. DependTarget()                                @@\
  864. LintTarget()                                @@\
  865.                                     @@\
  866. clean::                                    @@\
  867.     RemoveFile(ProgramTargetName(program))
  868. #endif /* ComplexCplusplusProgramTarget */
  869.  
  870. /*
  871.  * ComplexProgramTargetNoMan - generate rules for compiling and linking
  872.  * the program specified by $(OBJS) and $(SRCS), installing the program
  873.  * and generating dependencies.  It should only be used in Imakefiles
  874.  * that describe a single program, and have no manual page.
  875.  */
  876. #ifndef ComplexProgramTargetNoMan
  877. #define ComplexProgramTargetNoMan(program)                @@\
  878.         PROGRAM = ProgramTargetName(program)                @@\
  879.                                     @@\
  880. AllTarget(ProgramTargetName(program))                    @@\
  881.                                     @@\
  882. ProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
  883.                                     @@\
  884. DependTarget()                                @@\
  885. LintTarget()                                @@\
  886.                                     @@\
  887. clean::                                    @@\
  888.     RemoveFile(ProgramTargetName(program))
  889. #endif /* ComplexProgramTargetNoMan */
  890.  
  891. #ifndef ComplexCplusplusProgramTarget
  892. #define    ComplexCplusplusProgramTarget(program)                @@\
  893.         PROGRAM = program                        @@\
  894.                                     @@\
  895. AllTarget(program)                            @@\
  896.                                     @@\
  897. CplusplusProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
  898.                                     @@\
  899. DependTarget()                                @@\
  900. LintTarget()                                @@\
  901.                                     @@\
  902. clean::                                    @@\
  903.     RemoveFile(ProgramTargetName(program))
  904. #endif /* ComplexCplusplusProgramTarget */
  905.  
  906. /*
  907.  * ComplexProgramTarget_1 - generate rules for compiling and linking the
  908.  * program specified by $(OBJS1) and $(SRCS1), installing the program and its
  909.  * man page, and generating dependencies for it and any programs described
  910.  * by $(SRCS2) through $(SRCS10).  It should be used to build the primary
  911.  * program in Imakefiles that describe multiple programs.
  912.  */
  913. #ifndef ComplexProgramTarget_1
  914. #define    ComplexProgramTarget_1(program,locallib,syslib)            @@\
  915.   OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \            @@\
  916.          $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10)            @@\
  917.   SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \            @@\
  918.          $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10)            @@\
  919.                                     @@\
  920. AllTarget($(PROGRAMS))                            @@\
  921.                                     @@\
  922. ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)    @@\
  923.                                     @@\
  924. DependTarget()                                @@\
  925. LintTarget()                                @@\
  926.                                     @@\
  927. clean::                                    @@\
  928.     RemoveFiles($(PROGRAMS))
  929. #endif /* ComplexProgramTarget_1 */
  930.  
  931. #ifndef ComplexCplusplusProgramTarget_1
  932. #define    ComplexCplusplusProgramTarget_1(program,locallib,syslib)    @@\
  933.   OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \            @@\
  934.          $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10)            @@\
  935.   SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \            @@\
  936.          $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10)            @@\
  937.                                     @@\
  938. AllTarget($(PROGRAMS))                            @@\
  939.                                     @@\
  940. CplusplusProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)@@\
  941.                                     @@\
  942. DependTarget()                                @@\
  943. LintTarget()                                @@\
  944.                                     @@\
  945. clean::                                    @@\
  946.     RemoveFiles($(PROGRAMS))
  947. #endif /* ComplexCplusplusProgramTarget_1 */
  948.  
  949. /*
  950.  * ComplexProgramTarget_2 - generate rules for compiling and linking the
  951.  * program specified by $(OBJS2) and $(SRCS2) and installing the program and
  952.  * man page.  It should be used to build the second program in Imakefiles
  953.  * describing more than one program.
  954.  */
  955. #ifndef ComplexProgramTarget_2
  956. #define    ComplexProgramTarget_2(program,locallib,syslib)            @@\
  957. ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
  958. #endif /* ComplexProgramTarget_2 */
  959.  
  960. #ifndef ComplexCplusplusProgramTarget_2
  961. #define    ComplexCplusplusProgramTarget_2(program,locallib,syslib)    @@\
  962. CplusplusProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
  963. #endif /* ComplexCplusplusProgramTarget_2 */
  964.  
  965. /*
  966.  * ComplexProgramTarget_3 - generate rules for compiling and linking the
  967.  * program specified by $(OBJS3) and $(SRCS3) and installing the program and
  968.  * man page.  It should be used to build the third program in Imakefiles
  969.  * describing more than one program.
  970.  */
  971. #ifndef ComplexProgramTarget_3
  972. #define    ComplexProgramTarget_3(program,locallib,syslib)            @@\
  973. ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
  974. #endif /* ComplexProgramTarget_3 */
  975.  
  976. #ifndef ComplexCplusplusProgramTarget_3
  977. #define    ComplexCplusplusProgramTarget_3(program,locallib,syslib)    @@\
  978. CplusplusProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
  979. #endif /* ComplexCplusplusProgramTarget_3 */
  980.  
  981. /*
  982.  * ComplexProgramTarget_4 - generate rules for compiling and linking the
  983.  * program specified by $(OBJS4) and $(SRCS4) and installing the program and
  984.  * man page.  It should be used to build the third program in Imakefiles
  985.  * describing more than one program.
  986.  */
  987. #ifndef ComplexProgramTarget_4
  988. #define    ComplexProgramTarget_4(program,locallib,syslib)            @@\
  989. ProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
  990. #endif /* ComplexProgramTarget_4 */
  991.  
  992. #ifndef ComplexCplusplusProgramTarget_4
  993. #define    ComplexCplusplusProgramTarget_4(program,locallib,syslib)    @@\
  994. CplusplusProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
  995. #endif /* ComplexCplusplusProgramTarget_4 */
  996.  
  997. /*
  998.  * ComplexProgramTarget_5 - generate rules for compiling and linking the
  999.  * program specified by $(OBJS5) and $(SRCS5) and installing the program and
  1000.  * man page.  It should be used to build the third program in Imakefiles
  1001.  * describing more than one program.
  1002.  */
  1003. #ifndef ComplexProgramTarget_5
  1004. #define    ComplexProgramTarget_5(program,locallib,syslib)            @@\
  1005. ProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
  1006. #endif /* ComplexProgramTarget_5 */
  1007.  
  1008. #ifndef ComplexCplusplusProgramTarget_5
  1009. #define    ComplexCplusplusProgramTarget_5(program,locallib,syslib)    @@\
  1010. CplusplusProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
  1011. #endif /* ComplexCplusplusProgramTarget_5 */
  1012.  
  1013. /*
  1014.  * ComplexProgramTarget_6 - generate rules for compiling and linking the
  1015.  * program specified by $(OBJS6) and $(SRCS6) and installing the program and
  1016.  * man page.  It should be used to build the third program in Imakefiles
  1017.  * describing more than one program.
  1018.  */
  1019. #ifndef ComplexProgramTarget_6
  1020. #define    ComplexProgramTarget_6(program,locallib,syslib)            @@\
  1021. ProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
  1022. #endif /* ComplexProgramTarget_6 */
  1023.  
  1024. #ifndef ComplexCplusplusProgramTarget_6
  1025. #define    ComplexCplusplusProgramTarget_6(program,locallib,syslib)    @@\
  1026. CplusplusProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
  1027. #endif /* ComplexCplusplusProgramTarget_6 */
  1028.  
  1029. /*
  1030.  * ComplexProgramTarget_7 - generate rules for compiling and linking the
  1031.  * program specified by $(OBJS7) and $(SRCS7) and installing the program and
  1032.  * man page.  It should be used to build the third program in Imakefiles
  1033.  * describing more than one program.
  1034.  */
  1035. #ifndef ComplexProgramTarget_7
  1036. #define    ComplexProgramTarget_7(program,locallib,syslib)            @@\
  1037. ProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
  1038. #endif /* ComplexProgramTarget_7 */
  1039.  
  1040. #ifndef ComplexCplusplusProgramTarget_7
  1041. #define    ComplexCplusplusProgramTarget_7(program,locallib,syslib)    @@\
  1042. CplusplusProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
  1043. #endif /* ComplexCplusplusProgramTarget_7 */
  1044.  
  1045. /*
  1046.  * ComplexProgramTarget_8 - generate rules for compiling and linking the
  1047.  * program specified by $(OBJS8) and $(SRCS8) and installing the program and
  1048.  * man page.  It should be used to build the third program in Imakefiles
  1049.  * describing more than one program.
  1050.  */
  1051. #ifndef ComplexProgramTarget_8
  1052. #define    ComplexProgramTarget_8(program,locallib,syslib)            @@\
  1053. ProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
  1054. #endif /* ComplexProgramTarget_8 */
  1055.  
  1056. #ifndef ComplexCplusplusProgramTarget_8
  1057. #define    ComplexCplusplusProgramTarget_8(program,locallib,syslib)    @@\
  1058. CplusplusProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
  1059. #endif /* ComplexCplusplusProgramTarget_8 */
  1060.  
  1061. /*
  1062.  * ComplexProgramTarget_9 - generate rules for compiling and linking the
  1063.  * program specified by $(OBJS9) and $(SRCS9) and installing the program and
  1064.  * man page.  It should be used to build the third program in Imakefiles
  1065.  * describing more than one program.
  1066.  */
  1067. #ifndef ComplexProgramTarget_9
  1068. #define    ComplexProgramTarget_9(program,locallib,syslib)            @@\
  1069. ProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
  1070. #endif /* ComplexProgramTarget_9 */
  1071.  
  1072. #ifndef ComplexCplusplusProgramTarget_9
  1073. #define    ComplexCplusplusProgramTarget_9(program,locallib,syslib)    @@\
  1074. CplusplusProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
  1075. #endif /* ComplexCplusplusProgramTarget_9 */
  1076.  
  1077. /*
  1078.  * ComplexProgramTarget_10 - generate rules for compiling and linking the
  1079.  * program specified by $(OBJS10) and $(SRCS10) and installing the program and
  1080.  * man page.  It should be used to build the third program in Imakefiles
  1081.  * describing more than one program.
  1082.  */
  1083. #ifndef ComplexProgramTarget_10
  1084. #define    ComplexProgramTarget_10(program,locallib,syslib)        @@\
  1085. ProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
  1086. #endif /* ComplexProgramTarget_10 */
  1087.  
  1088. #ifndef ComplexCplusplusProgramTarget_10
  1089. #define    ComplexCplusplusProgramTarget_10(program,locallib,syslib)    @@\
  1090. CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
  1091. #endif /* ComplexCplusplusProgramTarget_10 */
  1092.  
  1093. #ifndef MoveToBakFile
  1094. #define MoveToBakFile(file) -@if [ -f file ]; then set -x; \        @@\
  1095.     $(MV) file file.bak; else exit 0; fi
  1096. #endif /* MoveToBakFile */
  1097.  
  1098. #ifndef RMoveToBakFile
  1099. #define RMoveToBakFile(file) -@if [ -f file ]; then set -x; \        @@\
  1100.     RemoveFile(file.bak); $(MV) file file.bak; \            @@\
  1101.     else exit 0; fi
  1102. #endif /* RMoveToBakFile */
  1103.  
  1104. /*
  1105.  * ServerTargetWithFlags - generate rules to compile, link, and relink a server
  1106.  */
  1107. #ifndef ServerTargetWithFlags
  1108. #define    ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
  1109. AllTarget(ProgramTargetName(server))                    @@\
  1110. ProgramTargetName(server): subdirs objects libs                @@\
  1111.     MoveToBakFile($@)                        @@\
  1112.     LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
  1113.                                     @@\
  1114. Concat(load,server):                            @@\
  1115.     MoveToBakFile(ProgramTargetName(server))            @@\
  1116.     LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
  1117.                                     @@\
  1118. loadX:: Concat(load,server)                        @@\
  1119.                                     @@\
  1120. SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
  1121. SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
  1122. PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
  1123. PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
  1124. ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
  1125. ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
  1126.                                     @@\
  1127. InstallProgramWithFlags(server,$(BINDIR),flags)                @@\
  1128.                                     @@\
  1129. clean::                                    @@\
  1130.     RemoveFile(ProgramTargetName(server))
  1131. #endif /* ServerTargetWithFlags */
  1132.  
  1133. /*
  1134.  * ServerTarget - rules to compile, link, and relink a normal server
  1135.  */
  1136. #ifndef ServerTarget
  1137. #define    ServerTarget(server,subdirs,objects,libs,syslibs)        @@\
  1138. ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
  1139. #endif /* ServerTarget */
  1140.  
  1141. #if DoRanlibCmd
  1142. #define RanLibrary(args) $(RANLIB) args
  1143. #else
  1144. #define RanLibrary(args) $(_NULLCMD_)
  1145. #endif
  1146.  
  1147. #ifndef LibraryTargetName
  1148. #define LibraryTargetName(libname)Concat(lib,libname.a)
  1149. #endif
  1150.  
  1151. /* This rule is used for libs in Xserver/Imakefile which are loaded, not
  1152.  * linked into the core module. Since modules are called libXXXX.a,
  1153.  * this rule mustn't be overriden by .cf files.
  1154.  */
  1155. #ifndef ModuleLibraryTargetName
  1156. #define ModuleLibraryTargetName(libname)Concat(lib,libname.a)
  1157. #endif
  1158.  
  1159. #ifndef LibraryTargetNameSuffix
  1160. #define LibraryTargetNameSuffix(libname,suffix)Concat3(lib,libname,suffix.a)
  1161. #endif
  1162.  
  1163. #ifndef InstallNamedInline
  1164. #define InstallNamedInline(srcname,flags,dest,dstname) $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname
  1165. #endif
  1166.  
  1167. #ifndef InstallNamedTarget
  1168. #define InstallNamedTarget(step,srcname,flags,dest,dstname)        @@\
  1169. step:: srcname                                @@\
  1170.     MakeDir($(DESTDIR)dest)                        @@\
  1171.     InstallNamedInline(srcname,flags,dest,dstname)
  1172. #endif /* InstallNamedTarget */
  1173.  
  1174. /*
  1175.  * InstallNamedTargetNoClobber - Like InstallNamedTarget, but doesn't
  1176.  * do the install if an installed version already exists.  Useful
  1177.  * for files that might have local customizations that you don't
  1178.  * want to clobber.  Config files are good candidates for this.
  1179.  */
  1180. #ifndef InstallNamedTargetNoClobber
  1181. #define InstallNamedTargetNoClobber(step,srcname,flags,dest,dstname)    @@\
  1182. step:: srcname                                @@\
  1183.     MakeDir($(DESTDIR)dest)                        @@\
  1184.     @if [ -f $(DESTDIR)dest/dstname ]; then \            @@\
  1185.      echo "Not overwriting existing" $(DESTDIR)dest/dstname; \    @@\
  1186.     else set -x; \                            @@\
  1187.      $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi
  1188. #endif /* InstallNamedTargetNoClobber */
  1189.  
  1190. #ifndef InstallTarget
  1191. #define InstallTarget(step,file,flags,dest)                @@\
  1192. InstallNamedTarget(step,file,flags,dest,file)
  1193. #endif /* InstallTarget */
  1194.  
  1195. #ifndef InstallInline
  1196. #define InstallInline(file,flags,dest) InstallNamedInline(file,flags,dest,file)
  1197. #endif
  1198.  
  1199. /*
  1200.  * InstallLibrary - generate rules to install the indicated library.
  1201.  */
  1202. #ifndef InstallLibrary
  1203. #define    InstallLibrary(libname,dest)                    @@\
  1204. install:: LibraryTargetName(libname)                    @@\
  1205.     MakeDir($(DESTDIR)dest)                        @@\
  1206.     $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
  1207.     RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
  1208. #endif /* InstallLibrary */
  1209.  
  1210.  
  1211. /*
  1212.  * InstallDriverSDKLibrary - rule to install Driver SDK library.
  1213.  *                           (only used for XFree86). This is a no-op
  1214.  *                           rule so that Imakefiles on non-XFree86 systems
  1215.  *                           continue to build Makefiles correctly.
  1216.  */
  1217. #ifndef InstallDriverSDKLibrary
  1218. #define InstallDriverSDKLibrary(lib,dir)
  1219. #endif
  1220.  
  1221.  
  1222. /*
  1223.  * InstallDriverSDKNamedLibrary - rule to install Driver SDK library.
  1224.  *                         (only used for XFree86). This is a no-op
  1225.  *                         rule so that Imakefiles on non-XFree86 systems
  1226.  *                         continue to build Makefiles correctly.
  1227.  */
  1228. #ifndef InstallDriverSDKNamedLibrary
  1229. #define InstallDriverSDKNamedLibrary(lib,dlib,dir)
  1230. #endif
  1231.  
  1232.  
  1233. /*
  1234.  * InstallDriverSDKLibraryModule - rule to install Driver SDK library module.
  1235.  *                           (only used for XFree86). This is a no-op
  1236.  *                           rule so that Imakefiles on non-XFree86 systems
  1237.  *                           continue to build Makefiles correctly.
  1238.  */
  1239. #ifndef InstallDriverSDKLibraryModule
  1240. #define InstallDriverSDKLibraryModule(lib,dlib,dir)
  1241. #endif
  1242.  
  1243.  
  1244. /*
  1245.  * MergeIntoInstalledLibrary - generate rules to merge one library into another
  1246.  */
  1247. #ifndef MergeIntoInstalledLibrary
  1248. #define MergeIntoInstalledLibrary(tolib,fromlib)            @@\
  1249. install::  fromlib                            @@\
  1250.     $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
  1251. #endif /* MergeIntoInstalledLibrary */
  1252.  
  1253. /*
  1254.  * InstallLibraryAlias - generate rules to create a link from one library name
  1255.  * to another for the purposes of aliasing.
  1256.  */
  1257. #ifndef InstallLibraryAlias
  1258. #define    InstallLibraryAlias(libname,alias,dest)                @@\
  1259. install::                                @@\
  1260.     -(cd $(DESTDIR)dest && ( \                    @@\
  1261.         RemoveFile(LibraryTargetName(alias)); \            @@\
  1262.         $(LN) LibraryTargetName(libname) LibraryTargetName(alias)))
  1263. #endif /* InstallLibraryAlias */
  1264.  
  1265.  
  1266. /*
  1267.  * InstallLintLibrary - generate rules to install the indicated lint library.
  1268.  */
  1269. #ifndef InstallLintLibrary
  1270. #define    InstallLintLibrary(libname,dest)                @@\
  1271. InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest)
  1272. #endif /* InstallLintLibrary */
  1273.  
  1274.  
  1275. #if !CompressManPages
  1276. /*
  1277.  * InstallManPageLong - generate rules to install the indicated manual page,
  1278.  * giving it an alternate name.  This is used for installing man pages whose
  1279.  * base name without the .man suffix would normally be longer than 8 characters
  1280.  * (the limit for using source code control systems on files systems with
  1281.  * short file names).
  1282.  */
  1283. #ifndef InstallManPageLong
  1284. #define    InstallManPageLong(file,destdir,dest)                @@\
  1285. BuildInstallHtmlManPage(file,dest,$(MANSUFFIX))                @@\
  1286.                                     @@\
  1287. CppManTarget(file,$(EXTRAMANDEFS))                    @@\
  1288.                                     @@\
  1289. InstallNamedTarget(install.man,file.$(MANNEWSUFFIX),$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX))
  1290. #endif /* InstallManPageLong */
  1291.  
  1292.  
  1293. /*
  1294.  * InstallManPageAliases - generate rules to install manual page aliases.
  1295.  */
  1296. #ifndef InstallManPageAliases
  1297. #define    InstallManPageAliases(file,destdir,aliases)            @@\
  1298. InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX))            @@\
  1299.                                     @@\
  1300. install.man::                                @@\
  1301.     @(TMP="#tmp.$$$$"; \                        @@\
  1302.     RemoveFile($${TMP}); \                        @@\
  1303.     echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \    @@\
  1304.     for i in aliases; do (set -x; \                    @@\
  1305.     $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\
  1306.     done; \                                @@\
  1307.     RemoveFile($${TMP}))
  1308. #endif /* InstallManPageAliases */
  1309.  
  1310.  
  1311. /*
  1312.  * InstallGenManPageLong - More general rules for installing manual pages --
  1313.  * doesn't assume MANSUFFIX.
  1314.  */
  1315. #ifndef InstallGenManPageLong
  1316. #define    InstallGenManPageLong(file,destdir,dest,suffix)            @@\
  1317. BuildInstallHtmlManPage(file,dest,suffix)                @@\
  1318.                                     @@\
  1319. CppManTarget(file, $(EXTRAMANDEFS))                    @@\
  1320.                                     @@\
  1321. install.man:: file.$(MANNEWSUFFIX)                    @@\
  1322.     MakeDir($(DESTDIR)destdir)                    @@\
  1323.     $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \        @@\
  1324.         $(DESTDIR)destdir/dest.suffix
  1325. #endif /* InstallGenManPageLong */
  1326.  
  1327.  
  1328. /*
  1329.  * InstallGenManPageAliases - general equivalent of InstallManPageAliases
  1330.  */
  1331. #ifndef InstallGenManPageAliases
  1332. #define    InstallGenManPageAliases(file,destdir,suffix,aliases)        @@\
  1333. InstallHtmlManPageAliases(file,aliases,suffix)                @@\
  1334.                                     @@\
  1335. install.man::                                @@\
  1336.     @(TMP="#tmp.$$$$"; \                        @@\
  1337.     RemoveFile($${TMP}); \                        @@\
  1338.     echo .so `basename destdir`/file.suffix > $${TMP}; \        @@\
  1339.     for i in aliases; do (set -x; \                    @@\
  1340.     $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.suffix); \ @@\
  1341.     done; \                                @@\
  1342.     RemoveFile($${TMP}))
  1343. #endif /* InstallGenManPageAliases */
  1344.  
  1345. #else /* CompressManPages */
  1346.  
  1347. #ifndef InstallManPageLong
  1348. #define InstallManPageLong(file,destdir,dest)                @@\
  1349. BuildInstallHtmlManPage(file,dest,$(MANSUFFIX))                @@\
  1350.                                     @@\
  1351. CppManTarget(file, $(EXTRAMANDEFS))                    @@\
  1352.                                     @@\
  1353. install.man:: file.$(MANNEWSUFFIX)                    @@\
  1354.     MakeDir($(DESTDIR)destdir)                    @@\
  1355.     $(RM) $(DESTDIR)destdir/dest.$(MANSUFFIX)*            @@\
  1356.     $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \        @@\
  1357.       $(DESTDIR)destdir/dest.$(MANSUFFIX)                @@\
  1358.     -$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.$(MANSUFFIX)
  1359. #endif
  1360.  
  1361. #ifndef InstallGenManPageLong
  1362. #define InstallGenManPageLong(file,destdir,dest,suffix)            @@\
  1363. BuildInstallHtmlManPage(file,dest,suffix)                @@\
  1364.                                     @@\
  1365. CppManTarget(file, $(EXTRAMANDEFS))                    @@\
  1366.                                     @@\
  1367. install.man:: file.$(MANNEWSUFFIX)                    @@\
  1368.     MakeDir($(DESTDIR)destdir)                    @@\
  1369.     $(RM) $(DESTDIR)destdir/dest.suffix*                @@\
  1370.     $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \        @@\
  1371.       $(DESTDIR)destdir/dest.suffix                    @@\
  1372.     -$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.suffix
  1373. #endif
  1374.  
  1375. #ifndef InstallMultipleMan
  1376. #define InstallMultipleMan(list,dest)                    @@\
  1377. install.man:: list                            @@\
  1378.     MakeDir($(DESTDIR)dest)                        @@\
  1379.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@\
  1380.     for i in list; do \                        @@\
  1381.         (MNAME=`echo $$i | cut -f1 -d.`; \            @@\
  1382.         set -x;    \                        @@\
  1383.         $(RM) $(DESTDIR)dest/$${MNAME}*; \            @@\
  1384.         $(INSTALL) -c $(INSTMANFLAGS) $$i \            @@\
  1385.           $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX); \        @@\
  1386.         $(COMPRESSMANCMD) $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX)); \ @@\
  1387.     done
  1388. #endif
  1389.  
  1390. /*
  1391.  * InstallManPageAliases - install soft links for aliases.
  1392.  */
  1393. #ifndef InstallManPageAliasesBase
  1394. #define InstallManPageAliasesBase(file,destdir,aliases)            @@\
  1395. install.man::                                @@\
  1396.     @(SUFFIX=`echo $(DESTDIR)destdir/file.* | sed -e 's,.*/[^\.]*.,,'`; \ @@\
  1397.     for i in aliases; do (set -x; \                    @@\
  1398.     $(RM) $(DESTDIR)destdir/$$i.*; \                @@\
  1399.     (cd $(DESTDIR)destdir; $(LN) file.$${SUFFIX} \            @@\
  1400.     $$i.$${SUFFIX})); \                        @@\
  1401.     done)
  1402. #endif
  1403.  
  1404. #ifndef InstallManPageAliases
  1405. #define InstallManPageAliases(file,destdir,aliases)            @@\
  1406. InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX))            @@\
  1407.                                     @@\
  1408. InstallManPageAliasesBase(file,destdir,aliases)
  1409. #endif
  1410.  
  1411.  
  1412. /*
  1413.  * InstallGenManPageAliases - install soft links for aliases.
  1414.  */
  1415. #ifndef InstallGenManPageAliases
  1416. #define InstallGenManPageAliases(file,destdir,suffix,aliases)        @@\
  1417. InstallHtmlManPageAliases(file,aliases,suffix)                @@\
  1418.                                     @@\
  1419. InstallManPageAliasesBase(file,destdir,aliases)
  1420. #endif
  1421.  
  1422. #endif /* CompressManPages */
  1423.  
  1424.  
  1425. /*
  1426.  * InstallManPage - generate rules to install the indicated manual page.
  1427.  */
  1428. #ifndef InstallManPage
  1429. #define    InstallManPage(file,destdir)                    @@\
  1430. InstallManPageLong(file,destdir,file)
  1431. #endif /* InstallManPage */
  1432.  
  1433.  
  1434. /*
  1435.  * InstallGenManPage - general equivalent of InstallManPage
  1436.  */
  1437. #ifndef InstallGenManPage
  1438. #define    InstallGenManPage(file,destdir,suffix)                @@\
  1439. InstallGenManPageLong(file,destdir,file,suffix)
  1440. #endif /* InstallGenManPage */
  1441.  
  1442.  
  1443. /*
  1444.  * RmanDependency - generate rules to build the rman program if
  1445.  * this Imakefile is within the source tree.
  1446.  */
  1447. #ifndef RmanDependency
  1448. #ifdef UseInstalled
  1449. #define RmanDependency() /**/
  1450. #else
  1451. #define RmanDependency()                        @@\
  1452. NoCmpScript(ProgramTargetName($(RMAN)))                    @@\
  1453.                                     @@\
  1454. ProgramTargetName($(RMAN)):                        @@\
  1455.     @echo "checking $(RMANBASENAME) over in $(TOP)/config/util first..."; \    @@\
  1456.     cd $(TOP)/config/util && $(MAKE) rmanonly; \            @@\
  1457.     echo "okay, continuing in $(CURRENT_DIR)"
  1458.  
  1459. #endif /* UseInstalled */
  1460. #endif /* RmanDependency */
  1461.  
  1462. #ifndef RmanCmdDependency
  1463. #ifdef UseInstalled
  1464. #define RmanCmdDependency    /**/
  1465. #else
  1466. #define RmanCmdDependency    ProgramTargetName($(RMAN))
  1467. #endif
  1468. #endif
  1469.  
  1470. #ifndef BuildInstallHtmlManPage
  1471. #if BuildHtmlManPages
  1472. #define BuildInstallHtmlManPage(file,dest,suffix)            @@\
  1473. AllTarget(dest.suffix.html)                        @@\
  1474.                                     @@\
  1475. dest.suffix.html: file.$(MANNEWSUFFIX) RmanCmdDependency        @@\
  1476.     RemoveFiles(dest.suffix.html dest.suffix-html)            @@\
  1477.     RunProgram(RMAN,$(RMANOPTIONS) < file.$(MANNEWSUFFIX) \        @@\
  1478.       > dest.suffix-html) && $(MV) dest.suffix-html $@        @@\
  1479.                                     @@\
  1480. install.man:: dest.suffix.html                        @@\
  1481.     MakeDir($(DESTDIR)$(DOCHTMLDIR))                @@\
  1482.     @(SUF=`expr suffix \: '\(.\)'`; \                @@\
  1483.      set -x; \                            @@\
  1484.      $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) dest.suffix.html $(DESTDIR)$(DOCHTMLDIR)/dest.$$SUF.html)    @@\
  1485.                                     @@\
  1486. clean::                                    @@\
  1487.     RemoveFiles(dest.suffix.html dest.suffix-html)
  1488. #else
  1489. #define BuildInstallHtmlManPage(file,dest,suffix) /**/
  1490. #endif
  1491. #endif
  1492.  
  1493. #ifndef InstallHtmlManPageAliases
  1494. #if BuildHtmlManPages
  1495. #define InstallHtmlManPageAliases(file,aliases,suffix)            @@\
  1496. install.man:: file.suffix.html                        @@\
  1497.     MakeDir($(DESTDIR)$(DOCHTMLDIR))                @@\
  1498.     @SUF=`expr suffix \: '\(.\)'`; \                @@\
  1499.     for i in aliases; do (set -x; \                    @@\
  1500.       RemoveFile($(DESTDIR)$(DOCHTMLDIR)/$$i.$$SUF.html); \        @@\
  1501.       (cd $(DESTDIR)$(DOCHTMLDIR); \                @@\
  1502.         $(LN) file.$$SUF.html $$i.$$SUF.html)); \            @@\
  1503.     done
  1504. #else
  1505. #define InstallHtmlManPageAliases(file,aliases,suffix) /**/
  1506. #endif
  1507. #endif
  1508.  
  1509. #ifndef HtmlManIndex
  1510. #if BuildHtmlManPages
  1511. #define HtmlManIndex                            @@\
  1512. html_index::                                @@\
  1513.     MakeDir($(DESTDIR)$(DOCHTMLDIR))                @@\
  1514.     $(HTMLINDEXCMD) $(DESTDIR)$(DOCHTMLDIR)
  1515. #else
  1516. #define HtmlManIndex    html_index::
  1517. #endif
  1518. #endif
  1519.  
  1520.  
  1521. /*
  1522.  * ManKeywordsTarget - generate the database used by "man -k".
  1523.  * This rule updates the index in the directory "manpath", which
  1524.  * indexes all the manual pages in the section subdirectories under
  1525.  * it.  An update command is defined only on systems that have a
  1526.  * per MANPATH element index.  If the OS supports only one system-wide
  1527.  * database, we don't update it, because then we can't do cross
  1528.  * installations or use a non-empty DESTDIR for testing.
  1529.  */
  1530. #ifndef ManKeywordsTarget
  1531. #define ManKeywordsTarget(manpath) man_keywords::
  1532. #endif
  1533.  
  1534. /*
  1535.  * InstallNamedNonExec - generate rules to install a data file
  1536.  */
  1537. #ifndef InstallNamedNonExec
  1538. #define    InstallNamedNonExec(srcname,dstname,dest)            @@\
  1539. InstallNamedTarget(install,srcname,$(INSTDATFLAGS),dest,dstname)
  1540. #endif /* InstallNamedNonExec */
  1541.  
  1542.  
  1543. /*
  1544.  * InstallDriverSDKNamedNonExec - rule for installing server Driver SDK files.
  1545.  *                         (only used for XFree86). This is a no-op
  1546.  *                         rule so that Imakefiles on non-XFree86 systems
  1547.  *                         continue to build Makefiles correctly.
  1548.  */
  1549. #ifndef InstallDriverSDKNamedNonExec
  1550. #define InstallDriverSDKNamedNonExec(srcname,dstname,dest)
  1551. #endif
  1552.  
  1553.  
  1554. /*
  1555.  * InstallNonExecFile - generate rules to install a data file
  1556.  */
  1557. #ifndef InstallNonExecFile
  1558. #define InstallNonExecFile(file,dest)                    @@\
  1559. InstallTarget(install,file,$(INSTDATFLAGS),dest)
  1560. #endif /* InstallNonExecFile */
  1561.  
  1562.  
  1563. /*
  1564.  * InstallNonExecFileNoClobber - install a data file once
  1565.  */
  1566. #ifndef InstallNonExecFileNoClobber
  1567. #define InstallNonExecFileNoClobber(file,dest)                @@\
  1568. InstallNamedTargetNoClobber(install,file,$(INSTDATFLAGS),dest,file)
  1569. #endif /* InstallNonExecFileNoClobber */
  1570.  
  1571.  
  1572. /*
  1573.  * InstallDriverSDKNonExecFile - rule for installing server Driver SDK files.
  1574.  *                         (only used for XFree86). This is a no-op
  1575.  *                         rule so that Imakefiles on non-XFree86 systems
  1576.  *                         continue to build Makefiles correctly.
  1577.  */
  1578. #ifndef InstallDriverSDKNonExecFile
  1579. #define InstallDriverSDKNonExecFile(file,dir)
  1580. #endif
  1581.  
  1582.  
  1583. /*
  1584.  * InstallNonExec - generate rules to install a data file, but does not
  1585.  * try to create the destination directory (deprecated)
  1586.  */
  1587. #ifndef InstallNonExec
  1588. #define    InstallNonExec(file,dest)                    @@\
  1589. install:: file                                @@\
  1590.     $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) file $(DESTDIR)dest
  1591. #endif /* InstallNonExec */
  1592.  
  1593.  
  1594. /*
  1595.  * InstallProgramWithFlags - generate rules to install an executable program
  1596.  * using given install flags.
  1597.  */
  1598. #ifndef InstallProgramWithFlags
  1599. #if StripInstalledPrograms && CrossCompiling
  1600. #define InstallProgramWithFlags(program,dest,flags)            @@\
  1601. InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest) @@\
  1602.     CrossStripCmd $(DESTDIR)dest/ProgramTargetName(program)
  1603. #else
  1604. #define InstallProgramWithFlags(program,dest,flags)            @@\
  1605. InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest)
  1606. #endif /* StripInstalledPrograms && CrossCompiling */
  1607. #endif /* InstallProgramWithFlags */
  1608.  
  1609.  
  1610. /*
  1611.  * InstallProgram - generate rules to install an executable program using any
  1612.  * special install flags set in $(INSTALLFLAGS).
  1613.  */
  1614. #ifndef InstallProgram
  1615. #define    InstallProgram(program,dest)                    @@\
  1616. InstallProgramWithFlags(program,dest,NullParameter)
  1617. #endif /* InstallProgram */
  1618.  
  1619.  
  1620.  
  1621. /*
  1622.  * InstallScript - install a shell script.
  1623.  */
  1624. #ifndef InstallScript
  1625. #define    InstallScript(program,dest)                    @@\
  1626. InstallNamedTarget(install,program.script,$(INSTBINFLAGS),dest,program)
  1627. #endif /* InstallScript */
  1628.  
  1629.  
  1630. /*
  1631.  * InstallNamedProg - install a program with renaming and no stripping.
  1632.  */
  1633. #ifndef InstallNamedProg
  1634. #define InstallNamedProg(srcname,dstname,dest)                @@\
  1635. InstallNamedTarget(install,srcname,$(INSTBINFLAGS),dest,dstname)
  1636. #endif /* InstallNamedProg */
  1637.  
  1638.  
  1639. /*
  1640.  * InstallNamedProgNoClobber - Like InstallNamedProg, but doesn't
  1641.  * do the install if an installed version already exists.
  1642.  */
  1643. #ifndef InstallNamedProgNoClobber
  1644. #define InstallNamedProgNoClobber(srcname,dstname,dest)            @@\
  1645. InstallNamedTargetNoClobber(install,srcname,$(INSTBINFLAGS),dest,dstname)
  1646. #endif /* InstallNamedProgNoClobber */
  1647.  
  1648.  
  1649. /*
  1650.  * InstallDriverSDKNamedProg - rule for installing server Driver SDK files.
  1651.  *                         (only used for XFree86). This is a no-op
  1652.  *                         rule so that Imakefiles on non-XFree86 systems
  1653.  *                         continue to build Makefiles correctly.
  1654.  */
  1655. #ifndef InstallDriverSDKNamedProg
  1656. #define InstallDriverSDKNamedProg(srcname,dstname,dest)
  1657. #endif
  1658.  
  1659.  
  1660. /*
  1661.  * MakeFlagsToShellFlags - set variables before starting a loop.
  1662.  * makeflags is the set of "make" flags to check.
  1663.  * shellcmd is the shell command to execute if any of the flags are set.
  1664.  *
  1665.  * The usual use of this rule is to translate make's "don't quit on error"
  1666.  * flags into the equivalent for the shell.  To do this, "make -i" always
  1667.  * becomes "set +e".  "make -k" should also turn on "set +e" if the target
  1668.  * is building subdirectories.  That is, subdirectories are independent
  1669.  * and should appear to be multiple targets, even though they are
  1670.  * implemented in a loop in a single target.
  1671.  */
  1672. #ifndef MakeFlagsToShellFlags
  1673. #define MakeFlagsToShellFlags(makeflags,shellcmd)\
  1674.     for flag in ${MAKEFLAGS} ''; do \                @@\
  1675.       case "$$flag" in *=*) ;; --*) ;; *[makeflags]*) shellcmd;; esac; done
  1676. #endif
  1677.  
  1678. /*
  1679.  * MakeNamedTargetSubdir - do make in a subdir.
  1680.  */
  1681. #ifndef MakeNamedTargetSubdir
  1682. #define MakeNamedTargetSubdir(dir,flags,subname)\
  1683.         (cd dir && $(MAKE) $(MFLAGS) $(PARALLELMFLAGS) \    @@\
  1684.             flags subname)
  1685. #endif
  1686.  
  1687. /*
  1688.  * LinkFileList - link a list of files from one place to another
  1689.  */
  1690. #ifndef LinkFileList
  1691. #define LinkFileList(step,list,dir,sub)                    @@\
  1692. step::                                    @@\
  1693.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1694.     echo "    cd" dir; cd dir && \                    @@\
  1695.     for i in list; do (set -x; $(LN) -f sub/$$i .); done
  1696. #endif
  1697.  
  1698.  
  1699. /*
  1700.  * LinkConfDirectoryLong
  1701.  *
  1702.  * Make links from opath (usually <ProjectRoot>/lib/X11) to npath
  1703.  * For example /usr/X11R6/lib/X11/xdm ==> /etc/X11/xdm so that X
  1704.  * binaries can be mounted from a read-only volume like a CD-ROM;
  1705.  * but files that may need to be edited can be stored locally on
  1706.  * read-write media. If someone has an existing installation, be
  1707.  * careful and move existing files to the new location in /etc.
  1708.  * XXX Need to make the installation script do this when installing
  1709.  * binary distributions.
  1710.  *
  1711.  * Since the link is used in the installation process, we need to
  1712.  * make the link relative in order to honor $(DESTDIR) if it is set.
  1713.  *
  1714.  * Note: The sed script used here is not completely general.  It assumes
  1715.  * that no elements of the path are '..', and that none start with '.'
  1716.  * that aren't just '.'.
  1717.  *
  1718.  * For a more general solution $(REVPATH) could be used.  Even though
  1719.  * it was intended for something a little different, it does do what is
  1720.  * required here.
  1721.  *
  1722.  */
  1723. #ifndef LinkConfDirectoryLong
  1724. #if UseSeparateConfDir && HasSymLinks
  1725. #define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath)        @@\
  1726. install::                                @@\
  1727.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1728.     if [ -h Concat($(DESTDIR),npath/mdir) ]; then \            @@\
  1729.       $(RM) Concat($(DESTDIR),npath/mdir); \            @@\
  1730.     fi                                @@\
  1731.     MakeDir(Concat($(DESTDIR),opath/cdir))                @@\
  1732.     MakeDir(Concat($(DESTDIR),npath/mdir))                @@\
  1733.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1734.     if [ -d Concat($(DESTDIR),opath/cdir) ]; then \            @@\
  1735.       RELPATH=`echo opath/cdir | \                    @@\
  1736.         sed -e 's:^/::' -e 's:[^/.][^/]*:..:'g -e 's:/\.$$::'`; \ @@\
  1737.       cd Concat($(DESTDIR),opath/cdir); \                @@\
  1738.       if [ -d rdir -a ! -h rdir ]; then \                @@\
  1739.         (cd rdir; tar cf - . | \                    @@\
  1740.         (cd Concat($(DESTDIR),npath/mdir); \            @@\
  1741.          tar xf -; exit 0); exit 0); \                @@\
  1742.       fi; \                                @@\
  1743.       $(RM) -r rdir; \                        @@\
  1744.       $(LN) Concat($${RELPATH},npath/mdir) ldir; \            @@\
  1745.     fi
  1746. #else
  1747. #define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath)
  1748. #endif
  1749. #endif
  1750.  
  1751. #ifndef LinkConfDirectory
  1752. #define LinkConfDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(CONFDIR))
  1753. #endif
  1754.  
  1755. #ifndef LinkVarDirectory
  1756. #define LinkVarDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(VARDIR))
  1757. #endif
  1758.  
  1759. /*
  1760.  * LinkConfFileLong
  1761.  *
  1762.  * Make links from opath (<ProjectRoot>/lib/X11) to npath
  1763.  * For example /usr/X11R6/lib/X11/xxx ==> /etc/X11/xxx so that X binaries
  1764.  * can be mounted from a read-only volume like a CD-ROM;
  1765.  * but files that may need to be edited can be stored locally on
  1766.  * read-write media. If someone has an existing installation, be
  1767.  * careful and move existing files to the new location in /etc.
  1768.  * XXX Need to make the installation script do this when installing
  1769.  * binary distributions.
  1770.  *
  1771.  * Since the link is used in the installation process, we need to
  1772.  * make the link relative in order to honor $(DESTDIR) if it is set.
  1773.  */
  1774. #ifndef LinkConfFileLong
  1775. #if UseSeparateConfDir && HasSymLinks
  1776. #define LinkConfFileLong(cfile,lfile,opath,npath)            @@\
  1777. install::                                @@\
  1778.     MakeDir(Concat($(DESTDIR),opath))                @@\
  1779.     MakeDir(Concat($(DESTDIR),npath))                @@\
  1780.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1781.     if [ -d Concat($(DESTDIR),opath) ]; then \            @@\
  1782.       RELPATH=`echo opath | \                    @@\
  1783.         sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \        @@\
  1784.       cd Concat($(DESTDIR),opath); \                @@\
  1785.       if [ -f lfile -a ! -h lfile ]; then \                @@\
  1786.         cp -p lfile Concat($(DESTDIR),npath/cfile); \        @@\
  1787.       fi; \                                @@\
  1788.       $(RM) -r lfile; \                        @@\
  1789.       $(LN) Concat($${RELPATH},npath/cfile) lfile; \        @@\
  1790.     fi
  1791. #else
  1792. #define LinkConfFileLong(cfile,lfile,opath,npath)
  1793. #endif
  1794. #endif
  1795.  
  1796.  
  1797. #ifndef LinkConfFile
  1798. #define LinkConfFile(cfile,lfile) LinkConfFileLong(cfile,lfile,$(LIBDIR),$(CONFDIR))
  1799. #endif
  1800.  
  1801. /*
  1802.  * InstallMultipleDestFlags - generate rules to install multiple files at
  1803.  * once during a particular step in the build using a specific set of install
  1804.  * flags.
  1805.  */
  1806. #ifndef InstallMultipleDestFlags
  1807. #define InstallMultipleDestFlags(step,list,dest,flags)            @@\
  1808. step:: list                                @@\
  1809.     MakeDir($(DESTDIR)dest)                        @@\
  1810.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1811.     for i in list; do \                        @@\
  1812.         (set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \    @@\
  1813.     done
  1814. #endif /* InstallMultipleDestFlags */
  1815.  
  1816.  
  1817. /*
  1818.  * InstallDriverSDKMultipleDestFlags - rule for installing server Driver SDK
  1819.  *                         files. (only used for XFree86). This is a no-op
  1820.  *                         rule so that Imakefiles on non-XFree86 systems
  1821.  *                         continue to build Makefiles correctly.
  1822.  */
  1823. #ifndef InstallDriverSDKMultipleDestFlags
  1824. #define InstallDriverSDKMultipleDestFlags(list,dest,flags)
  1825. #endif
  1826.  
  1827.  
  1828. /*
  1829.  * InstallMultipleDest - generate rules to install multiple files at once
  1830.  * during a particular step in the build using any install flags set in
  1831.  * $(INSTDATFLAGS).
  1832.  */
  1833. #ifndef InstallMultipleDest
  1834. #define InstallMultipleDest(step,list,dest)                @@\
  1835. InstallMultipleDestFlags(step,list,dest,$(INSTDATFLAGS))
  1836. #endif /* InstallMultipleDest */
  1837.  
  1838. /*
  1839.  * InstallMultiple - generate rules to install multiple files at once
  1840.  * during the install step of the build using any install flags set in
  1841.  * $(INSTALLFLAGS).
  1842.  */
  1843. #ifndef InstallMultiple
  1844. #define    InstallMultiple(list,dest)                    @@\
  1845. InstallMultipleDest(install,list,dest)
  1846. #endif /* InstallMultiple */
  1847.  
  1848.  
  1849. /*
  1850.  * InstallMultipleFlags - generate rules to install multiple files at once
  1851.  * during the install step of the build using the given install flags.
  1852.  */
  1853. #ifndef InstallMultipleFlags
  1854. #define InstallMultipleFlags(list,dest,flags)                @@\
  1855. InstallMultipleDestFlags(install,list,dest,flags)
  1856. #endif /* InstallMultipleFlags */
  1857.  
  1858.  
  1859. /*
  1860.  * InstallMultipleMan - generate rules to install a variety of manual pages
  1861.  * during the install.man step of the build.
  1862.  */
  1863. #ifndef InstallMultipleMan
  1864. #define InstallMultipleMan(list,dest)                    @@\
  1865. InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
  1866. #endif /* InstallMultipleMan */
  1867.  
  1868. /*
  1869.  * InstallMultipleManSuffix - generate rules to install multiple manual
  1870.  * pages dufing the install.man step of the build, where
  1871.  * the target files have the suffix given.
  1872.  */
  1873. #ifndef InstallMultipleManSuffix
  1874. #define InstallMultipleManSuffix(list,dest,suffix)            @@\
  1875. install.man::                                @@\
  1876.     MakeDir($(DESTDIR)dest)                        @@\
  1877.     @MakeFlagsToShellFlags(i,set +e); \                @@\
  1878.     for i in list; do \                        @@\
  1879.       (set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $$i.suffix $(DESTDIR)dest/$$i.$(MANSUFFIX)); \    @@\
  1880.     done
  1881. #endif /* InstallMultipleManSuffix */
  1882.  
  1883.  
  1884. /*
  1885.  * IncludeMakefile - rule to include another Makefile.
  1886.  * Must not generate an error or even a warning if the named file
  1887.  * is not present, since we use this to include Makefile.dep, which
  1888.  * may not be built yet.
  1889.  * This is defined non-null iff HasMakefileSafeInclude is YES.
  1890.  * The double-@ is to ensure no leading spaces on the line.
  1891.  */
  1892. #ifndef IncludeMakefile
  1893. #if HasClearmake
  1894. #define IncludeMakefile(file) @@sinclude file
  1895. #else
  1896. #if HasBsdMake
  1897. #define IncludeMakefile(file) @@# dependencies are in .depend
  1898. #else
  1899. #define IncludeMakefile(file) /**/
  1900. #endif
  1901. #endif
  1902. #endif
  1903.  
  1904. /*
  1905.  * DependDependencyStatement - Used by DependDependency to set up the
  1906.  * most specific dependency, which differs based on whether we support
  1907.  * a separate Makefile.dep on this platform.
  1908.  */
  1909. #ifndef DependDependencyStatement
  1910. #if HasMakefileSafeInclude
  1911. #define DependDependencyStatement()                    @@\
  1912. DependFileName:: ProgramTargetName($(DEPEND))
  1913. #else
  1914. #define DependDependencyStatement()                    @@\
  1915. depend:: ProgramTargetName($(DEPEND))
  1916. #endif
  1917. #endif
  1918.  
  1919. /*
  1920.  * DependDependency - generate rules to build the makedepend program if
  1921.  * this Imakefile is within the source tree.
  1922.  */
  1923. #ifndef DependDependency
  1924. #ifdef UseInstalled
  1925. #define DependDependency() /**/
  1926. #else
  1927. #define DependDependency()                        @@\
  1928. DependDependencyStatement()                        @@\
  1929.                                     @@\
  1930. NoCmpScript(ProgramTargetName($(DEPEND)))                @@\
  1931.                                     @@\
  1932. ProgramTargetName($(DEPEND)):                        @@\
  1933.     @echo "checking $@ over in $(DEPENDSRC) first..."; \        @@\
  1934.     cd $(DEPENDSRC) && $(MAKE) makedependonly; \            @@\
  1935.     echo "okay, continuing in $(CURRENT_DIR)"
  1936.  
  1937. #endif /* UseInstalled */
  1938. #endif /* DependDependency */
  1939.  
  1940.  
  1941. /*
  1942.  * DependTarget - generate rules to compute dependencies for all files listed
  1943.  * in $(SRCS).
  1944.  */
  1945. #ifndef DependTarget
  1946. #if HasMakefileSafeInclude
  1947. #define DependTarget()                            @@\
  1948. DependDependency()                            @@\
  1949.                                     @@\
  1950. depend:: DependFileName                            @@\
  1951.                                     @@\
  1952. DependFileName::                            @@\
  1953.     RemoveFile($@)                            @@\
  1954.     RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) > $@
  1955. #else /* HasMakefileSafeInclude */
  1956. #define    DependTarget()                            @@\
  1957. DependDependency()                            @@\
  1958.                                     @@\
  1959. depend::                                @@\
  1960.     RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS))
  1961. #endif /* HasMakefileSafeInclude else */
  1962. #endif /* DependTarget */
  1963.  
  1964. /*
  1965.  * DependTarget3 - generate rules to compute dependencies for all files given.
  1966.  */
  1967. #ifndef DependTarget3
  1968. #if HasMakefileSafeInclude
  1969. #define DependTarget3(srcs1,srcs2,srcs3)                @@\
  1970. DependDependency()                            @@\
  1971.                                     @@\
  1972. depend:: DependFileName                            @@\
  1973.                                     @@\
  1974. DependFileName::                            @@\
  1975.     RemoveFile($@)                            @@\
  1976.     RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) > $@    @@\
  1977.     RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) >> $@    @@\
  1978.     RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) >> $@
  1979. #else /* HasMakefileSafeInclude */
  1980. #define    DependTarget3(srcs1,srcs2,srcs3)                @@\
  1981. DependDependency()                            @@\
  1982.                                     @@\
  1983. depend::                                @@\
  1984.     RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1)    @@\
  1985.     RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2)    @@\
  1986.     RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3)
  1987. #endif /* HasMakefileSafeInclude else */
  1988. #endif /* DependTarget3 */
  1989.  
  1990.  
  1991. /*
  1992.  * CleanTarget - generate rules to remove any garbage files
  1993.  */
  1994. #ifndef CleanTarget
  1995. #define    CleanTarget()                            @@\
  1996. clean::                                    @@\
  1997.     $(RM) FilesToClean ExtraFilesToClean DocFilesToClean "#"*    @@\
  1998.                                     @@\
  1999. ProofCleanTarget()
  2000. #endif /* CleanTarget */
  2001.  
  2002.  
  2003. /*
  2004.  * TagsTarget - generate rules to compute tags files for C source code.
  2005.  */
  2006. #ifndef TagsTarget
  2007. #define    TagsTarget()                            @@\
  2008. tags::                                    @@\
  2009.     $(TAGS) -w *.[ch]                        @@\
  2010.     $(TAGS) -xw *.[ch] > TAGS
  2011. #endif /* TagsTarget */
  2012.  
  2013.  
  2014. /*
  2015.  * ImakeDependency - generate rules to compile imake if this Imakefile is
  2016.  * within the source tree.
  2017.  */
  2018. #ifndef ImakeDependency
  2019. #ifdef UseInstalled
  2020. #define ImakeDependency(target) /**/
  2021. #else
  2022. #define ImakeDependency(target)                        @@\
  2023. target:: ProgramTargetName($(IMAKE))                    @@\
  2024.                                     @@\
  2025. NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf)            @@\
  2026.                                     @@\
  2027. ProgramTargetName($(IMAKE)) $(IMAKE).Osuf:                @@\
  2028.     -@(cd $(IMAKESRC) && if [ -f Makefile ]; then \            @@\
  2029.     echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) imakeonly; else \    @@\
  2030.     echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \    @@\
  2031.     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \    @@\
  2032.     echo "okay, continuing in $(CURRENT_DIR)")
  2033. #endif /* UseInstalled */
  2034. #endif /* ImakeDependency */
  2035.  
  2036.  
  2037. /*
  2038.  * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
  2039.  * and any special imake flags.  This is generally done automatically by the
  2040.  * template or by any special Imakefiles.  The first argument exists just
  2041.  * because imakeflags is usually empty and some preprocessors will complain
  2042.  * if an empty argument is passed as the sole argument to a macro.
  2043.  */
  2044. #ifndef BuildMakefileTarget
  2045. #define    BuildMakefileTarget(notused,imakeflags)                @@\
  2046. ImakeDependency(Makefile)                        @@\
  2047.                                     @@\
  2048. Makefile::                                @@\
  2049.     RMoveToBakFile(Makefile)                    @@\
  2050.     $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
  2051.  
  2052. #endif /* BuildMakefileTarget */
  2053.  
  2054.  
  2055. /*
  2056.  * MakefileTarget - generate rules to build a normal Makefile.
  2057.  */
  2058. #ifndef MakefileTarget
  2059. #define MakefileTarget()                        @@\
  2060. BuildMakefileTarget(Imakefile,NullParameter)
  2061. #endif /* MakefileTarget */
  2062.  
  2063.  
  2064. /*
  2065.  * LibMkdir - helper for creating library object subdirectories
  2066.  */
  2067. #ifndef LibMkdir
  2068. #define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
  2069. #endif
  2070.  
  2071. #ifndef LibMkdirLinkSubdirs
  2072. #define LibMkdirLinkSubdirs(dir) DirFailPrefix@if [ -d dir ]; then \    @@\
  2073.         exit 0; \                            @@\
  2074.     else \                                @@\
  2075.         echo "mkdir dir"; mkdir dir; \                @@\
  2076.         for i in $(SUBDIRS); do \                    @@\
  2077.           j=`echo "$$i" | sed -e 's;[^/]\{1,\};..;g'`; \        @@\
  2078.           if [ ! -d "dir/`dirname $$i`" ]; then \            @@\
  2079.         $(MKDIRHIER) "dir/`dirname $$i`"; \            @@\
  2080.           fi; \                            @@\
  2081.           echo $(LN) "$$j/$$i/dir" "dir/$$i"; \            @@\
  2082.           $(LN) "$$j/$$i/dir" "dir/$$i"; \                @@\
  2083.         done; \                            @@\
  2084.     fi
  2085. #endif
  2086.  
  2087. /*
  2088.  * LibCleanDir - helper for cleaning library object subdirectories
  2089.  */
  2090. #ifndef LibCleanDir
  2091. #define LibCleanDir(dir) -@if [ -d dir ]; then \            @@\
  2092.         set -x; $(RM) -r dir; else exit 0; fi
  2093. #endif
  2094.  
  2095. /*
  2096.  * LintLibReferences - variables for lint libraries
  2097.  */
  2098. #ifndef LintLibReferences
  2099. #define LintLibReferences(varname,libname,libsource)            @@\
  2100. Concat(LINT,varname) = _UseCat($(LINTLIBDIR)/llib-l,libsource/llib-,libname.ln)
  2101. #endif
  2102.  
  2103.  
  2104. /*
  2105.  * UnsharedLibReferences - variables for unshared libraries
  2106.  */
  2107. #ifndef UnsharedLibReferences
  2108. #define UnsharedLibReferences(varname,libname,libsource)        @@\
  2109. ProjectUnsharedLibReferences(varname,libname,libsource,$(BUILDLIBDIR))
  2110. #endif
  2111.  
  2112. /*
  2113.  * ProjectUnsharedLibReferences - variables for unshared libraries
  2114.  */
  2115. #ifndef ProjectUnsharedLibReferences
  2116. #define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir)    @@\
  2117. Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/,buildlibdir/,LibraryTargetName(libname))    @@\
  2118. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)        @@\
  2119. LintLibReferences(varname,libname,libsource)
  2120. #endif
  2121.  
  2122.  /*
  2123.  * ProjectUnsharedFontLibReferences - unshared font libraries
  2124.  */
  2125. #ifndef ProjectUnsharedFontLibReferences
  2126. #define ProjectUnsharedFontLibReferences()                    @@\
  2127. DEPFONTLIB = _UseCat($(USRLIBDIR)/,XBuildLibDir/,LibraryTargetName(Xfont))    @@\
  2128. FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) LoaderLibPrefix -lXfont        @@\
  2129. LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
  2130. #endif
  2131.  
  2132. /*
  2133.  * SharedLibDependencies - shared library dependencies
  2134.  */
  2135. #ifndef SharedLibDependencies
  2136. #define SharedLibDependencies(libname,libsource,revname) /**/
  2137. #endif
  2138.  
  2139. /*
  2140.  * SharedFontLibReferences - shared font libraries
  2141.  */
  2142. #ifndef SharedFontLibReferences
  2143. #define SharedFontLibReferences()                    @@\
  2144. SOFONTREV = SharedFontRev                        @@\
  2145. DEPFONTLIB = SharedLibDependencies(Xfont,$(FONTLIBSRC),SOFONTREV)    @@\
  2146. FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) LoaderLibPrefix -lXfont    @@\
  2147. LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
  2148. #endif
  2149.  
  2150. /*
  2151.  * SharedDSLibDependencies - shared library dependencies with data separation
  2152.  */
  2153. #ifndef SharedDSLibDependencies
  2154. #define SharedDSLibDependencies(libname,libsource,revname) /**/
  2155. #endif
  2156.  
  2157. /*
  2158.  * SharedLibReferences - variables for shared libraries
  2159.  */
  2160. #ifndef SharedLibReferences
  2161. #define SharedLibReferences(varname,libname,libsource,revname,rev)    @@\
  2162. revname = rev                                @@\
  2163. Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\
  2164. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)        @@\
  2165. LintLibReferences(varname,libname,libsource)
  2166. #endif
  2167.  
  2168. /*
  2169.  * SharedDSLibReferences - variables for shared libraries with data separation
  2170.  */
  2171. #ifndef SharedDSLibReferences
  2172. #define SharedDSLibReferences(varname,libname,libsource,revname,rev)    @@\
  2173. revname = rev                                @@\
  2174. Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\
  2175. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)        @@\
  2176. LintLibReferences(varname,libname,libsource)
  2177. #endif
  2178.  
  2179. /*
  2180.  * CPPOnlyCompile - run C compiler's preprocessor only
  2181.  */
  2182. #ifndef CPPOnlyCompile
  2183. #define CPPOnlyCompile(src,options) RemoveFile($@)            @@\
  2184.     ClearmakeOSName \
  2185.     $(CC) -E $(CFLAGS) options src > $@
  2186. #endif
  2187.  
  2188. /*
  2189.  * ObjectCompile - compile fragment for a normal object file
  2190.  */
  2191. #ifndef ObjectCompile
  2192. #define ObjectCompile(options) RemoveFile($@)                @@\
  2193.     ClearmakeOSName \
  2194.     $(CC) -c $(CFLAGS) options $*.c
  2195. #endif
  2196.  
  2197. /*
  2198.  * CompileCToAsm - compile C file to assembler
  2199.  */
  2200. #ifndef CompileCToAsm
  2201. #define CompileCToAsm(options) RemoveFile($@)                @@\
  2202.     ClearmakeOSName \
  2203.     $(CC) -S $(CFLAGS) options $*.c
  2204. #endif
  2205.  
  2206.  
  2207. /*
  2208.  * CompileCplusplusToAsm - compile C++ file to assembler
  2209.  */
  2210. #ifndef CompileCplusplusToAsm
  2211. #define CompileCplusplusToAsm(options) RemoveFile($@)            @@\
  2212.     ClearmakeOSName \
  2213.     $(CC) -S $(CFLAGS) options $*.cc
  2214. #endif
  2215.  
  2216.  
  2217. #ifndef ObjectCplusplusCompile
  2218. #define ObjectCplusplusCompile(options) RemoveFile($@)            @@\
  2219.     ClearmakeOSName \
  2220.     $(CXX) -c $(CXXFLAGS) options $*.CCsuf
  2221. #endif
  2222.  
  2223. /*
  2224.  * NormalLibObjCompile - compile fragment for a normal library object file
  2225.  */
  2226. #ifndef NormalLibObjCompile
  2227. #define NormalLibObjCompile(options) ObjectCompile(options)
  2228. #endif
  2229.  
  2230. #ifndef NormalRelocLibObjCompile
  2231. # if !StaticNeedsPicForShared
  2232. #  define NormalRelocLibObjCompile(options) NormalLibObjCompile(options)
  2233. # else
  2234. #  define NormalRelocLibObjCompile(options) NormalLibObjCompile(options $(PICFLAGS))
  2235. # endif
  2236. #endif
  2237.  
  2238. #ifndef NormalLibObjCplusplusCompile
  2239. #define NormalLibObjCplusplusCompile(options) ObjectCplusplusCompile(options)
  2240. #endif
  2241.  
  2242. /*
  2243.  * NormalSharedLibObjCompile - compile fragment for shared objects
  2244.  */
  2245. #ifndef NormalSharedLibObjCompile
  2246. #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
  2247. #endif
  2248.  
  2249. #ifndef NormalSharedLibObjCplusplusCompile
  2250. #define NormalSharedLibObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(CXXPICFLAGS))
  2251. #endif
  2252.  
  2253. /*
  2254.  * LibObjCompile - compile fragment for unshared/profiled/debugged objects
  2255.  */
  2256. #ifndef LibObjCompile
  2257. #if HasGcc || HasGcc2
  2258. #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@)        @@\
  2259.     ClearmakeOSName \
  2260.     $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \
  2261.     options $*.c -o dir/$@
  2262. #else
  2263. #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@)        @@\
  2264.     ClearmakeOSName \
  2265.     $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \
  2266.     options $*.c                            @@\
  2267.     $(MV) $@ dir/$@
  2268. #endif
  2269. #endif
  2270.  
  2271. #ifndef LibObjCplusplusCompile
  2272. #if HasGcc || HasGcc2
  2273. #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@)    @@\
  2274.     ClearmakeOSName \
  2275.     $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \
  2276.     options $*.CCsuf -o dir/$@
  2277. #else
  2278. #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@)    @@\
  2279.     ClearmakeOSName \
  2280.     $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \
  2281.     options $*.CCsuf                        @@\
  2282.     $(MV) $@ dir/$@
  2283. #endif
  2284. #endif
  2285.  
  2286. /*
  2287.  * DebuggedLibObjCompile - compile fragment for debugged objects
  2288.  */
  2289. #ifndef DebuggedLibObjCompile
  2290. #define DebuggedLibObjCompile(options) LibObjCompile(debugger,DebuggableCDebugFlags options)
  2291. #endif
  2292.  
  2293. #ifndef DebuggedLibObjCplusplusCompile
  2294. #define DebuggedLibObjCplusplusCompile(options) LibObjCplusplusCompile(debugger,DebuggableCplusplusDebugFlags options)
  2295. #endif
  2296.  
  2297. /*
  2298.  * ProfiledLibObjCompile - compile fragment for profiled objects
  2299.  */
  2300. #ifndef ProfiledLibObjCompile
  2301. #define ProfiledLibObjCompile(options) LibObjCompile(profiled,ProfiledCDebugFlags options)
  2302. #endif
  2303.  
  2304. #ifndef ProfiledLibObjCplusplusCompile
  2305. #define ProfiledLibObjCplusplusCompile(options) LibObjCplusplusCompile(profiled,ProfiledCplusplusDebugFlags options)
  2306. #endif
  2307.  
  2308. /*
  2309.  * UnsharedLibObjCompile - compile fragment for unshared objects
  2310.  */
  2311. #ifndef UnsharedLibObjCompile
  2312. #define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) options)
  2313. #endif
  2314.  
  2315. #ifndef UnsharedLibObjCplusplusCompile
  2316. #define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) options)
  2317. #endif
  2318.  
  2319. /*
  2320.  * SharedLibObjCompile - compile fragment for shared objects
  2321.  */
  2322. #ifndef SharedLibObjCompile
  2323. #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS))
  2324. #endif
  2325.  
  2326. /*
  2327.  * NormalLibraryObjectRule - for simple libraries
  2328.  */
  2329. #ifndef NormalLibraryObjectRule
  2330. #define    NormalLibraryObjectRule()                    @@\
  2331. .c.Osuf:                                @@\
  2332.     NormalLibObjCompile($(_NOOP_))
  2333. #endif /* NormalLibraryObjectRule */
  2334.  
  2335. #ifndef NormalCplusplusObjectRule
  2336. #define NormalCplusplusObjectRule()                    @@\
  2337. .CCsuf.Osuf:                                @@\
  2338.     NormalLibObjCplusplusCompile($(_NOOP_))
  2339. #endif
  2340.  
  2341. #ifndef NormalFortranObjectRule
  2342. #define NormalFortranObjectRule()                    @@\
  2343. .f.Osuf:                                @@\
  2344.     RemoveFile($@)                            @@\
  2345.     ClearmakeOSName \
  2346.     $(FC) -c $(FCFLAGS) $*.f
  2347. #endif
  2348.  
  2349. /*
  2350.  * SpecialObjectRule - generate rules to compile a file with special flags.
  2351.  */
  2352. #ifndef SpecialObjectRule
  2353. #define SpecialObjectRule(objs,depends,options)                @@\
  2354. objs:    depends                                @@\
  2355.     ObjectCompile(options)
  2356. #endif /* SpecialObjectRule */
  2357.  
  2358. #ifndef SpecialCplusplusObjectRule
  2359. #define SpecialCplusplusObjectRule(baseobj,basedep,options)        @@\
  2360. baseobj.Osuf:    basedep.CCsuf                        @@\
  2361.     ObjectCplusplusCompile(options)
  2362. #endif /* SpecialCplusplusObjectRule */
  2363.  
  2364. /*
  2365.  * SpecialCObjectRule - generate rules to compile a C file with special flags.
  2366.  *            also handles CodeCenter rules
  2367.  */
  2368. #ifndef SpecialCObjectRule
  2369. #define SpecialCObjectRule(basename,depends,options)            @@\
  2370. SpecialObjectRule(basename.Osuf,basename.c depends,options)        @@\
  2371.                                     @@\
  2372. basename.i: basename.c depends                        @@\
  2373.     CPPOnlyCompile(basename.c,options)                @@\
  2374.                                     @@\
  2375. basename.s: basename.c depends                        @@\
  2376.     CompileCToAsm(options)                        @@\
  2377.                                     @@\
  2378. CenterLoadTarget(debug_src,basename.c,NullParameter,$(ALLDEFINES) options)
  2379. #endif /* SpecialCObjectRule */
  2380.  
  2381.  
  2382. #ifndef ObjectFromSpecialSource
  2383. #define ObjectFromSpecialSource(dst,src,flags)                @@\
  2384. NoConfigRec(dst.c)                            @@\
  2385.                                     @@\
  2386. dst.c:  src.c                                @@\
  2387.     RemoveFile($@)                            @@\
  2388.     $(LN) $? $@                            @@\
  2389.                                     @@\
  2390. SpecialCObjectRule(dst,NullParameter,flags)                @@\
  2391.                                     @@\
  2392. includes:: dst.c                            @@\
  2393.                                     @@\
  2394. depend::  dst.c                                @@\
  2395.                                     @@\
  2396. clean::                                    @@\
  2397.     RemoveFile(dst.c)
  2398. #endif /* ObjectFromSpecialSource */
  2399.  
  2400. #ifndef CPPOnlyAsm
  2401. #define CPPOnlyAsm(basename,options) RemoveFile(basename.i)        @@\
  2402.     $(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | \    @@\
  2403.         grep -v '^\#' > basename.i
  2404. #endif
  2405.  
  2406. #ifndef AssembleObject
  2407. #define AssembleObject(flags) CPPOnlyAsm($*,flags)            @@\
  2408.     RemoveFile($*.o)                        @@\
  2409.     $(AS) -o $*.o $*.i                        @@\
  2410.     RemoveFile($*.i)
  2411. #endif
  2412.  
  2413. #ifndef NormalAsmObjectRule
  2414. #define NormalAsmObjectRule()                        @@\
  2415. .S.o:                                    @@\
  2416.     AssembleObject($(_NOOP_))                    @@\
  2417.                                     @@\
  2418. .S.i:                                    @@\
  2419.     CPPOnlyAsm($*,$(_NOOP_))
  2420. #endif
  2421.  
  2422. #ifndef ObjectFromSpecialAsmSource
  2423. #define ObjectFromSpecialAsmSource(dst,src,flags)            @@\
  2424. dst.S:  src.S                                @@\
  2425.     RemoveFile($@)                            @@\
  2426.     $(LN) $? $@                            @@\
  2427.                                     @@\
  2428. dst.o:  dst.S                                @@\
  2429.     AssembleObject(flags)                        @@\
  2430.                                     @@\
  2431. dst.i:  dst.S                                @@\
  2432.     CPPOnlyAsm(dst,flags)                        @@\
  2433.                                     @@\
  2434. depend:: dst.S                                @@\
  2435.                                     @@\
  2436. clean::                                    @@\
  2437.     RemoveFile(dst.S)
  2438. #endif
  2439.  
  2440. #ifndef ObjectFromAsmSource
  2441. #define ObjectFromAsmSource(src,flags)                    @@\
  2442.                                     @@\
  2443. src.o:  src.S                                @@\
  2444.     AssembleObject(flags)                        @@\
  2445.                                     @@\
  2446. src.i:  src.S                                @@\
  2447.     CPPOnlyAsm(src,flags)                        @@\
  2448.                                     @@\
  2449. depend:: src.S
  2450. #endif
  2451.  
  2452. #ifndef SwitchYYPrefix
  2453. #define SwitchYYPrefix(in,out,prefix) \
  2454.     sed 's/yy/prefix/g' in | sed 's/__REALLY_YY__/yy/' > out && RemoveFile(in)
  2455. #endif
  2456.  
  2457. #ifndef LexFilePrefix
  2458. #define LexFilePrefix(file,prefix)                    @@\
  2459. file.c: file.l                                @@\
  2460.     ClearmakeOSName \
  2461.     $(LEX) $(LFLAGS) file.l                        @@\
  2462.     SwitchYYPrefix(lex.yy.c,file.c,prefix)                @@\
  2463.                                     @@\
  2464. depend:: file.c                                @@\
  2465.                                     @@\
  2466. clean::                                    @@\
  2467.     RemoveFiles(lex.yy.c file.c)
  2468. #endif
  2469.  
  2470. #ifndef LexFileExplicit
  2471. #if HasClearmake        /* provide a place to hang ClearmakeOSName */
  2472. #define LexFileExplicit(file)                        @@\
  2473. file.c: file.l                                @@\
  2474.     ClearmakeOSName \
  2475.     $(LEX) $(LFLAGS) file.l                        @@\
  2476.     $(MV) lex.yy.c file.c
  2477. #else
  2478. #define LexFileExplicit(file) /* the default rule is fine */
  2479. #endif
  2480. #endif
  2481.  
  2482. #ifndef LexFile
  2483. #define LexFile(file)                            @@\
  2484. LexFileExplicit(file)                            @@\
  2485.                                     @@\
  2486. depend:: file.c                                @@\
  2487.                                     @@\
  2488. clean::                                    @@\
  2489.     RemoveFiles(lex.yy.c file.c)
  2490. #endif /* LexFile */
  2491.  
  2492.  
  2493. #ifndef M4File
  2494. #define M4File(file,includes)                        @@\
  2495. file: file.m4 includes                            @@\
  2496.     RemoveFile(file)                        @@\
  2497.     $(M4) $(M4FLAGS) file.m4 >file                    @@\
  2498.                                     @@\
  2499. depend:: file                                @@\
  2500.                                     @@\
  2501. clean::                                    @@\
  2502.     RemoveFile(file)
  2503. #endif /* M4File */
  2504.  
  2505. #ifndef YaccFilePrefix
  2506. #if HasGnuMake
  2507. #define YaccFilePrefix(file,flags,prefix)                @@\
  2508. depend:: file.c                                @@\
  2509.                                     @@\
  2510. file.h: file.c                                @@\
  2511.                                     @@\
  2512. file.c: file.y                                @@\
  2513.     ClearmakeOSName \
  2514.     $(YACC) flags file.y                        @@\
  2515.     SwitchYYPrefix(y.tab.c,file.c,prefix)                @@\
  2516.     @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \@@\
  2517.     else exit 0; fi                            @@\
  2518.                                     @@\
  2519. clean::                                    @@\
  2520.     RemoveFiles(y.tab.c y.tab.h file.h file.c)
  2521. #else
  2522. #define YaccFilePrefix(file,flags,prefix)                @@\
  2523. depend:: file.c                                @@\
  2524.                                     @@\
  2525. file.h file.c: file.y                            @@\
  2526.     ClearmakeOSName \
  2527.     $(YACC) flags file.y                        @@\
  2528.     SwitchYYPrefix(y.tab.c,file.c,prefix)                @@\
  2529.     @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \    @@\
  2530.     else exit 0; fi                            @@\
  2531.                                     @@\
  2532. clean::                                    @@\
  2533.     RemoveFiles(y.tab.c y.tab.h file.h file.c)
  2534. #endif
  2535. #endif /* YaccFile */
  2536.  
  2537. #ifndef YaccFile
  2538. #if HasGnuMake
  2539. #define YaccFile(file,flags)                        @@\
  2540. depend:: file.c                                @@\
  2541.                                     @@\
  2542. file.h: file.c                                @@\
  2543.                                     @@\
  2544. file.c: file.y                                @@\
  2545.     ClearmakeOSName \
  2546.     $(YACC) flags file.y                        @@\
  2547.     $(MV) y.tab.c file.c                        @@\
  2548.     @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \    @@\
  2549.     else exit 0; fi                            @@\
  2550.                                     @@\
  2551. clean::                                    @@\
  2552.     RemoveFiles(y.tab.c y.tab.h file.h file.c)
  2553. #else
  2554. #define YaccFile(file,flags)                        @@\
  2555. depend:: file.c                                @@\
  2556.                                     @@\
  2557. file.h file.c: file.y                            @@\
  2558.     ClearmakeOSName \
  2559.     $(YACC) flags file.y                        @@\
  2560.     $(MV) y.tab.c file.c                        @@\
  2561.     @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \    @@\
  2562.     else exit 0; fi                            @@\
  2563.                                     @@\
  2564. clean::                                    @@\
  2565.     RemoveFiles(y.tab.c y.tab.h file.h file.c)
  2566. #endif
  2567. #endif /* YaccFile */
  2568.  
  2569. #ifndef YaccFileNoFlags
  2570. #define YaccFileNoFlags(file)                        @@\
  2571. depend:: file.c                                @@\
  2572.                                     @@\
  2573. file.c: file.y                                @@\
  2574.     ClearmakeOSName \
  2575.     $(YACC) file.y                            @@\
  2576.     $(MV) y.tab.c file.c                        @@\
  2577.                                     @@\
  2578. clean::                                    @@\
  2579.     RemoveFiles(y.tab.c file.c)
  2580. #endif /* YaccFileNoFlags */
  2581.  
  2582.  
  2583. #ifndef MakeLibrary
  2584. #define MakeLibrary(libname,objlist) $(AR) libname objlist
  2585. #endif
  2586.  
  2587. #ifndef LinkBuildLibrary
  2588. #ifdef UseInstalled
  2589. #define LinkBuildLibrary(lib) $(_NULLCMD_)
  2590. #else
  2591. #define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR))            @@\
  2592.     RemoveFile($(BUILDLIBDIR)/lib)                    @@\
  2593.     cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .
  2594. #endif
  2595. #endif /* LinkBuildLibrary */
  2596.  
  2597. #ifndef LinkBuildLibraryMaybe
  2598. #ifdef UseInstalled
  2599. #define LinkBuildLibraryMaybe(lib,doit) $(_NULLCMD_)
  2600. #else
  2601. #define LinkBuildLibraryMaybe(lib,doit) MakeDir($(BUILDLIBDIR))        @@\
  2602.     @if doit; then (set -x; \                    @@\
  2603.       RemoveFile($(BUILDLIBDIR)/lib); \                @@\
  2604.       cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .); fi
  2605. #endif
  2606. #endif /* LinkBuildLibraryMaybe */
  2607.  
  2608. #ifndef _LinkBuildLibrary /* will get redefined elsewhere */
  2609. #define _LinkBuildLibrary(lib) $(_NULLCMD_)
  2610. #endif /* _LinkBuildLibrary */
  2611.  
  2612. #ifndef LinkBuildSonameLibrary
  2613. #ifdef UseInstalled
  2614. #define LinkBuildSonameLibrary(lib) true
  2615. #else
  2616. #define LinkBuildSonameLibrary(lib) MakeDirInline($(BUILDLIBDIR));\    @@\
  2617.     (set -x; RemoveFile($(BUILDLIBDIR)/lib);\            @@\
  2618.     (cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .))
  2619. #endif
  2620. #endif /* LinkBuildSonameLibrary */
  2621.  
  2622. #ifndef LinkBuildLibraryInline
  2623. #define LinkBuildLibraryInline(lib) LinkBuildSonameLibrary(lib)
  2624. #endif /* LinkBuildLibraryInline */
  2625.  
  2626. /*
  2627.  * NormalLibraryTarget - generate rules to create a library.
  2628.  */
  2629. #ifndef NormalLibraryTarget
  2630. #define    NormalLibraryTarget(libname,objlist)                @@\
  2631. AllTarget(LibraryTargetName(libname))                    @@\
  2632.                                     @@\
  2633. LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS)            @@\
  2634.     RemoveFile($@)                            @@\
  2635.     MakeLibrary($@,objlist)                        @@\
  2636.     RanLibrary($@)                            @@\
  2637.     _LinkBuildLibrary($@)
  2638. #endif /* NormalLibraryTarget */
  2639.  
  2640.  
  2641. /*
  2642.  * NormalLibraryTarget2 - generate rules to create a library in two steps.
  2643.  * This is used to create libraries with large numbers of files.
  2644.  */
  2645. #ifndef NormalLibraryTarget2
  2646. #define    NormalLibraryTarget2(libname,objlist1,objlist2)            @@\
  2647. AllTarget(LibraryTargetName(libname))                    @@\
  2648.                                     @@\
  2649. LibraryTargetName(libname): objlist1 objlist2 $(EXTRALIBRARYDEPS)    @@\
  2650.     RemoveFile($@)                            @@\
  2651.     MakeLibrary($@,objlist1)                    @@\
  2652.     MakeLibrary($@,objlist2)                    @@\
  2653.     RanLibrary($@)                            @@\
  2654.     _LinkBuildLibrary($@)
  2655. #endif /* NormalLibraryTarget2 */
  2656.  
  2657.  
  2658. /*
  2659.  * NormalLibraryTarget3 - generate rules to create a library in three steps.
  2660.  * This is used to create libraries with very large numbers of files.
  2661.  */
  2662. #ifndef NormalLibraryTarget3
  2663. #define    NormalLibraryTarget3(libname,objlist1,objlist2,objlist3)    @@\
  2664. AllTarget(LibraryTargetName(libname))                    @@\
  2665.                                     @@\
  2666. LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS)    @@\
  2667.     RemoveFile($@)                            @@\
  2668.     MakeLibrary($@,objlist1)                    @@\
  2669.     MakeLibrary($@,objlist2)                    @@\
  2670.     MakeLibrary($@,objlist3)                    @@\
  2671.     RanLibrary($@)                            @@\
  2672.     _LinkBuildLibrary($@)
  2673. #endif /* NormalLibraryTarget3 */
  2674.  
  2675.  
  2676. /*
  2677.  * NormalDepLibraryTarget - generate rules to create a library.
  2678.  */
  2679. #ifndef NormalDepLibraryTarget
  2680. #define    NormalDepLibraryTarget(libname,deplist,objlist)            @@\
  2681. AllTarget(LibraryTargetName(libname))                    @@\
  2682.                                     @@\
  2683. LibraryTargetName(libname): deplist $(EXTRALIBRARYDEPS)            @@\
  2684.     RemoveFile($@)                            @@\
  2685.     MakeLibrary($@,objlist)                        @@\
  2686.     RanLibrary($@)                            @@\
  2687.     _LinkBuildLibrary($@)
  2688. #endif /* NormalDepLibraryTarget */
  2689.  
  2690.  
  2691. /*
  2692.  * UnsharedLibraryTarget - generate rules to create a library.
  2693.  */
  2694. #ifndef UnsharedLibraryTarget
  2695. #define    UnsharedLibraryTarget(libname,objlist,down,up)            @@\
  2696. AllTarget(LibraryTargetName(libname))                    @@\
  2697.                                     @@\
  2698. LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS)            @@\
  2699.     RemoveFile($@)                            @@\
  2700.     @(set -x; cd down && MakeLibrary(up/$@,objlist)) || exit 1;    @@\
  2701.     RanLibrary($@)                            @@\
  2702.     _LinkBuildLibrary($@)
  2703. #endif /* UnsharedLibraryTarget */
  2704.  
  2705.  
  2706. /*
  2707.  * UnsharedLibraryTarget3 - generate rules to create a library in three steps.
  2708.  * This is used to create libraries with very large numbers of files.
  2709.  */
  2710. #ifndef UnsharedLibraryTarget3
  2711. #define    UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
  2712. AllTarget(LibraryTargetName(libname))                    @@\
  2713.                                     @@\
  2714. LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS)    @@\
  2715.     RemoveFile($@)                            @@\
  2716.     (cd down && MakeLibrary(up/$@,objlist1))            @@\
  2717.     (cd down && MakeLibrary(up/$@,objlist2))            @@\
  2718.     (cd down && MakeLibrary(up/$@,objlist3))            @@\
  2719.     RanLibrary($@)                            @@\
  2720.     _LinkBuildLibrary($@)
  2721. #endif /* UnsharedLibraryTarget3 */
  2722.  
  2723.  
  2724. /*
  2725.  * SubdirLibraryRule -
  2726.  */
  2727. #ifndef SubdirLibraryRule
  2728. #define    SubdirLibraryRule(objlist)                    @@\
  2729. all:: DONE                                @@\
  2730.                                     @@\
  2731. DONE: objlist                                @@\
  2732.     RemoveFile($@)                            @@\
  2733.     touch $@                            @@\
  2734.                                     @@\
  2735. clean::                                    @@\
  2736.     RemoveFile(DONE)
  2737. #endif /* SubdirLibraryRule */
  2738.  
  2739.  
  2740. /*
  2741.  * ProfiledLibraryTarget - generate rules to create a profiled library.
  2742.  */
  2743. #ifndef ProfiledLibraryTarget
  2744. #define    ProfiledLibraryTarget(libname,objlist)                @@\
  2745. AllTarget(LibraryTargetNameSuffix(libname,_p))                @@\
  2746.                                     @@\
  2747. LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS)    @@\
  2748.     RemoveFile($@)                            @@\
  2749.     cd profiled && MakeLibrary(../$@,objlist)            @@\
  2750.     RanLibrary($@)
  2751.  
  2752. #endif /* ProfiledLibraryTarget */
  2753.  
  2754.  
  2755. /*
  2756.  * ProfiledDepLibraryTarget - generate rules to create a profiled library.
  2757.  */
  2758. #ifndef ProfiledDepLibraryTarget
  2759. #define    ProfiledDepLibraryTarget(libname,deplist,objlist)        @@\
  2760. AllTarget(LibraryTargetNameSuffix(libname,_p))                @@\
  2761.                                     @@\
  2762. LibraryTargetNameSuffix(libname,_p): deplist $(EXTRALIBRARYDEPS)    @@\
  2763.     RemoveFile($@)                            @@\
  2764.     MakeLibrary($@,objlist)                        @@\
  2765.     RanLibrary($@)
  2766.  
  2767. #endif /* ProfiledDepLibraryTarget */
  2768.  
  2769.  
  2770. /*
  2771.  * DebuggedLibraryTarget - generate rules to create a debuggable library.
  2772.  */
  2773. #ifndef DebuggedLibraryTarget
  2774. #define    DebuggedLibraryTarget(libname,objlist)                @@\
  2775. AllTarget(LibraryTargetNameSuffix(libname,_d))                @@\
  2776.                                     @@\
  2777. LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS)    @@\
  2778.     RemoveFile($@)                            @@\
  2779.     cd debugger && MakeLibrary(../$@,objlist)            @@\
  2780.     RanLibrary($@)
  2781.  
  2782. #endif /* DebuggedLibraryTarget */
  2783.  
  2784.  
  2785. /*
  2786.  * DebuggedDepLibraryTarget - generate rules to create a debuggable library.
  2787.  */
  2788. #ifndef DebuggedDepLibraryTarget
  2789. #define    DebuggedDepLibraryTarget(libname,deplist,objlist)        @@\
  2790. AllTarget(LibraryTargetNameSuffix(libname,_d))                @@\
  2791.                                     @@\
  2792. LibraryTargetNameSuffix(libname,_d): deplist $(EXTRALIBRARYDEPS)    @@\
  2793.     RemoveFile($@)                            @@\
  2794.     MakeLibrary($@,objlist)                        @@\
  2795.     RanLibrary($@)
  2796.  
  2797. #endif /* DebuggedDepLibraryTarget */
  2798.  
  2799.  
  2800. /*
  2801.  * AliasedLibraryTarget - generate rules to link one library to another.
  2802.  */
  2803. #ifndef AliasedLibraryTarget
  2804. #define    AliasedLibraryTarget(libname,alias)                @@\
  2805. AllTarget(LibraryTargetName(alias))                    @@\
  2806.                                     @@\
  2807. LibraryTargetName(alias): LibraryTargetName(libname)            @@\
  2808.     RemoveFile($@)                            @@\
  2809.     $(LN) LibraryTargetName(libname) $@                @@\
  2810.                                     @@\
  2811. clean::                                    @@\
  2812.     RemoveFile(LibraryTargetName(alias))
  2813. #endif /* AliasedLibraryTarget */
  2814.  
  2815.  
  2816. /*
  2817.  * NormalRelocatableTarget - generate rules to produce a relocatable object
  2818.  * file instead of a library.
  2819.  */
  2820. #ifndef NormalRelocatableTarget
  2821. #define    NormalRelocatableTarget(objname,objlist)            @@\
  2822. AllTarget(objname.Osuf)                            @@\
  2823.                                     @@\
  2824. objname.Osuf: objlist $(EXTRALIBRARYDEPS)                @@\
  2825.     RemoveFile($@)                            @@\
  2826.     $(LD) $(LDCOMBINEFLAGS) objlist -o $@
  2827. #endif /* NormalRelocatableTarget */
  2828.  
  2829.  
  2830. /*
  2831.  * NormalDepRelocatableTarget - generate rules to produce a relocatable object
  2832.  * file instead of a library.
  2833.  */
  2834. #ifndef NormalDepRelocatableTarget
  2835. #define    NormalDepRelocatableTarget(objname,deplist,objlist)        @@\
  2836. AllTarget(objname.Osuf)                            @@\
  2837.                                     @@\
  2838. objname.Osuf: deplist $(EXTRALIBRARYDEPS)                @@\
  2839.     RemoveFile($@)                            @@\
  2840.     $(LD) $(LDCOMBINEFLAGS) objlist -o $@
  2841. #endif /* NormalDepRelocatableTarget */
  2842.  
  2843.  
  2844. /*
  2845.  * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
  2846.  * object file instead of a library.
  2847.  */
  2848. #ifndef ProfiledRelocatableTarget
  2849. #define    ProfiledRelocatableTarget(objname,objlist)            @@\
  2850. AllTarget(Concat(objname,_p.Osuf))                    @@\
  2851.                                     @@\
  2852. Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS)            @@\
  2853.     RemoveFile($@)                            @@\
  2854.     $(LD) -X -r objlist -o $@
  2855.  
  2856. #endif /* ProfiledRelocatableTarget */
  2857.  
  2858.  
  2859. /*
  2860.  * DebuggedRelocatableTarget - generate rules to produce a debuggable
  2861.  * relocatable object file instead of a library.
  2862.  */
  2863. #ifndef DebuggedRelocatableTarget
  2864. #define    DebuggedRelocatableTarget(objname,objlist)            @@\
  2865. AllTarget(Concat(objname,_d.Osuf))                    @@\
  2866.                                     @@\
  2867. Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS)            @@\
  2868.     RemoveFile($@)                            @@\
  2869.     $(LD) -X -r objlist -o $@
  2870.  
  2871. #endif /* DebuggedRelocatableTarget */
  2872.  
  2873.  
  2874. /*
  2875.  * LintLibraryTarget - generate rules to create a lint library.  Note that the
  2876.  * lint library is always forced to be newer than the library itself.
  2877.  */
  2878. #ifndef LintLibraryTarget
  2879. #define    LintLibraryTarget(libname,srclist)                @@\
  2880. lintlib:: Concat(llib-l,libname.ln)                    @@\
  2881.                                     @@\
  2882. Concat(llib-l,libname.ln): srclist $(EXTRALIBRARYDEPS)            @@\
  2883.     RemoveFile($@)                            @@\
  2884.     $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
  2885. #endif /* LintLibraryTarget */
  2886.  
  2887.  
  2888. /*
  2889.  * NormalLintTarget - generate rules to lint a set of sources.
  2890.  */
  2891. #ifndef NormalLintTarget
  2892. #define NormalLintTarget(srclist)                    @@\
  2893. lint:                                    @@\
  2894.     $(LINT) $(LINTFLAGS) srclist $(LINTLIBS)            @@\
  2895. lint1:                                    @@\
  2896.     $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  2897. #endif /* NormalLintTarget */
  2898.  
  2899.  
  2900. /*
  2901.  * LintTarget - generate rules to lint $(SRCS)
  2902.  */
  2903. #ifndef LintTarget
  2904. #define LintTarget()                            @@\
  2905. NormalLintTarget($(SRCS))
  2906. #endif
  2907.  
  2908.  
  2909. /*
  2910.  * LinkSourceFile - snag source file from some other directory
  2911.  */
  2912. #ifndef LinkSourceFile
  2913. #define LinkSourceFile(src,dir)                        @@\
  2914. src:  dir/src                                @@\
  2915.     RemoveFile($@)                            @@\
  2916.     $(LN) $? $@                            @@\
  2917.                                     @@\
  2918. NoConfigRec(src)                            @@\
  2919.                                     @@\
  2920. includes:: src                                @@\
  2921.                                     @@\
  2922. depend:: src                                @@\
  2923.                                     @@\
  2924. clean::                                    @@\
  2925.     RemoveFile(src)
  2926. #endif
  2927.  
  2928.  
  2929. /*
  2930.  * LinkFile - link a file
  2931.  */
  2932. #ifndef LinkFile
  2933. #define LinkFile(tofile,fromfile)                    @@\
  2934. tofile:: fromfile                            @@\
  2935.     RemoveFile($@)                            @@\
  2936.     $(LN) $? $@                            @@\
  2937.                                     @@\
  2938. NoConfigRec(tofile)                            @@\
  2939.                                     @@\
  2940. includes:: tofile                            @@\
  2941.                                     @@\
  2942. depend:: tofile                                @@\
  2943.                                     @@\
  2944. clean::                                    @@\
  2945.     RemoveFile(tofile)
  2946. #endif
  2947.  
  2948.  
  2949. #ifndef MakeSubincludesForBuild
  2950. #define MakeSubincludesForBuild(step,dir,srclist)            @@\
  2951. step::  dir srclist                            @@\
  2952.     @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@\
  2953.         set -x; cd dir && RemoveFiles($$list))            @@\
  2954.     @for i in srclist; do \                        @@\
  2955.         (set -x; cd dir && $(LN) ../$$i .); \            @@\
  2956.     done                                @@\
  2957.                                     @@\
  2958. dir::                                    @@\
  2959.     $(MKDIRHIER) dir                        @@\
  2960.                                     @@\
  2961. clean::                                    @@\
  2962.     @-(if [ -d dir ]; then \                    @@\
  2963.         list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@\
  2964.         set -x; cd dir && RemoveFile($$list); else exit 0; fi)
  2965. #endif
  2966.  
  2967.  
  2968. /*
  2969.  * LangNamedTargetSubdirs - recursively make a series of steps
  2970.  */
  2971. #ifndef LangNamedTargetSubdirs
  2972. #define LangNamedTargetSubdirs(lang,name,dirs,verb,flags,subname)    @@\
  2973. name::                                    @@\
  2974.     @MakeFlagsToShellFlags(ik,set +e); \                @@\
  2975.     for i in dirs ;\                        @@\
  2976.     do \                                @@\
  2977.         echo verb "in $(CURRENT_DIR)/$$i..."; \            @@\
  2978.         (cd $$i && LANG=lang $(MAKE) $(MFLAGS) flags subname);\ @@\
  2979.     done
  2980. #endif
  2981.  
  2982.  
  2983. /*
  2984.  * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
  2985.  * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
  2986.  * the following in the appropriate Imakefile
  2987.  *
  2988.  *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  2989.  */
  2990. #ifndef LangNamedMakeSubdirs
  2991. #define LangNamedMakeSubdirs(lang,name,dirs) \
  2992. LangNamedTargetSubdirs(lang,name,dirs,"making" name,PassCDebugFlags,all)
  2993. #endif /* LangNamedMakeSubdirs */
  2994.  
  2995. #ifndef LangMakeSubdirs
  2996. #define LangMakeSubdirs(lang,dirs)                    @@\
  2997. LangNamedMakeSubdirs(lang,all,dirs)
  2998. #endif /* LangMakeSubdirs */
  2999.  
  3000.  
  3001.  
  3002. /*
  3003.  * NamedTargetSubdirs - recursively make a series of steps
  3004.  */
  3005. #ifndef NamedTargetSubdirs
  3006. #define NamedTargetSubdirs(name,dirs,verb,flags,subname)        @@\
  3007. name::                                    @@\
  3008.     @MakeFlagsToShellFlags(ik,set +e); \                @@\
  3009.     for i in dirs ;\                        @@\
  3010.     do \                                @@\
  3011.         echo verb "in $(CURRENT_DIR)/$$i..."; \            @@\
  3012.         MakeNamedTargetSubdir($$i,flags,subname); \        @@\
  3013.     done
  3014. #endif
  3015.  
  3016.  
  3017. /*
  3018.  * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
  3019.  * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
  3020.  * the following in the appropriate Imakefile
  3021.  *
  3022.  *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  3023.  */
  3024. #ifndef NamedMakeSubdirs
  3025. #define NamedMakeSubdirs(name,dirs) \
  3026. NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
  3027. #endif /* NamedMakeSubdirs */
  3028.  
  3029. #ifndef MakeSubdirs
  3030. #define MakeSubdirs(dirs)                        @@\
  3031. NamedMakeSubdirs(all,dirs)
  3032. #endif /* MakeSubdirs */
  3033.  
  3034.  
  3035. /*
  3036.  * DependSubdirs - generate rules to recursively compute dependencies as
  3037.  * part of the make depend step.
  3038.  */
  3039. #ifndef DependSubdirs
  3040. #define DependSubdirs(dirs) \
  3041. NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
  3042. #endif /* DependSubdirs */
  3043.  
  3044.  
  3045. /*
  3046.  * ForceSubdirs - force make to build subdirectories
  3047.  */
  3048. #ifndef ForceSubdirs
  3049. #if !HasBsdMake
  3050. #define ForceSubdirs(dirs)                        @@\
  3051. dirs: FRC                                @@\
  3052.     @echo "making all in $(CURRENT_DIR)/$@..."            @@\
  3053.     @MakeNamedTargetSubdir($@,PassCDebugFlags,all)            @@\
  3054.                                     @@\
  3055. FRC:
  3056. #else
  3057. /* For BSD 4.4 make */
  3058. #define ForceSubdirs(dirs)                        @@\
  3059. dirs:    .EXEC                                @@\
  3060.     @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \        @@\
  3061.     $(MAKE) $(MFLAGS) PassCDebugFlags all                @@\
  3062.                                     @@\
  3063. .EXEC:
  3064. #endif
  3065.  
  3066. #endif /* ForceSubdirs */
  3067.  
  3068. /*
  3069.  * InstallSubdirs - generate rules to recursively install programs and files.
  3070.  */
  3071. #ifndef InstallSubdirs
  3072. #define InstallSubdirs(dirs) \
  3073. NamedTargetSubdirs(install,dirs,"installing",DESTDIR=$(DESTDIR),install)
  3074. #endif /* InstallSubdirs */
  3075.  
  3076.  
  3077. /*
  3078.  * InstallManSubdirs - generate rules to recursively install manual pages.
  3079.  */
  3080. #ifndef InstallManSubdirs
  3081. #define InstallManSubdirs(dirs) \
  3082. NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR=$(DESTDIR),install.man)
  3083. #endif /* InstallManSubdirs */
  3084.  
  3085.  
  3086. /*
  3087.  * IncludesSubdirs - generate rules to recursively put include files in build
  3088.  */
  3089. #ifndef IncludesSubdirs
  3090. #define IncludesSubdirs(dirs) \
  3091. NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
  3092. #endif
  3093.  
  3094.  
  3095. /*
  3096.  * InstallDriverSDKSubdirs - generate rules to recursively install Driver
  3097.  *                         SDK (only used for XFree86). This is a no-op
  3098.  *                         rule so that Imakefiles on non-XFree86 systems
  3099.  *                         continue to build Makefiles correctly.
  3100.  */
  3101. #ifndef InstallDriverSDKSubdirs
  3102. #define InstallDriverSDKSubdirs(dirs)
  3103. #endif
  3104.  
  3105. /*
  3106.  * InstallDriverSDKObjectModule - generate rules to recursively install Driver
  3107.  *                         SDK (only used for XFree86). This is a no-op
  3108.  *                         rule so that Imakefiles on non-XFree86 systems
  3109.  *                         continue to build Makefiles correctly.
  3110.  */
  3111. #ifndef InstallDriverSDKObjectModule
  3112. #define InstallDriverSDKObjectModule(module,dest,subdir)
  3113. #endif
  3114. #ifndef InstallDriverSDKObjectSubModule
  3115. #define InstallDriverSDKObjectSubModule(module,dest,subdir)
  3116. #endif
  3117.  
  3118.  
  3119.  
  3120. /*
  3121.  * CleanSubdirs - generate rules to recursively clean out garbage files.
  3122.  */
  3123. #define BootstrapCleanSubdirs /**/    /* used at top-level */
  3124. #ifndef NamedCleanSubdirs
  3125. #define NamedCleanSubdirs(name,dirs) \
  3126. NamedTargetSubdirs(name,dirs,"cleaning",BootstrapCleanSubdirs,clean)
  3127. #endif /* NamedCleanSubdirs */
  3128.  
  3129. #ifndef CleanSubdirs
  3130. #define CleanSubdirs(dirs) \
  3131. NamedCleanSubdirs(clean,dirs)
  3132. #endif
  3133.  
  3134.  
  3135. /*
  3136.  * TagSubdirs - generate rules to recursively create tags files.
  3137.  */
  3138. #ifndef NamedTagSubdirs
  3139. #define NamedTagSubdirs(name,dirs) \
  3140. NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
  3141. #endif /* TagSubdirs */
  3142.  
  3143. #ifndef TagSubdirs
  3144. #define TagSubdirs(dirs) \
  3145. NamedTagSubdirs(tags,dirs)
  3146. #endif
  3147.  
  3148. /*
  3149.  * MakeLintSubdirs - generate rules to recursively lint directories as part
  3150.  * of the named step.
  3151.  */
  3152. #ifndef MakeLintSubdirs
  3153. #define MakeLintSubdirs(dirs,target,subtarget) \
  3154. NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR=$(DESTDIR) LINTOPTS='$(LINTOPTS)',subtarget)
  3155. #endif /* MakeLintSubdirs */
  3156.  
  3157.  
  3158. /*
  3159.  * LintSubdirs - generate rules to recursively lint directories as part of
  3160.  * the make lint step.
  3161.  */
  3162. #ifndef LintSubdirs
  3163. #define LintSubdirs(dirs)                        @@\
  3164. MakeLintSubdirs(dirs,lint,lint)
  3165. #endif /* LintSubdirs */
  3166.  
  3167.  
  3168. /*
  3169.  * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
  3170.  */
  3171. #ifndef MakeLintLibSubdirs
  3172. #define MakeLintLibSubdirs(dirs)                    @@\
  3173. MakeLintSubdirs(dirs,lintlib,lintlib)
  3174. #endif /* MakeLintLibSubdirs */
  3175.  
  3176.  
  3177. /*
  3178.  * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
  3179.  * of the specified step in the build.  If $(TOP) is set to an absolute path,
  3180.  * do not prepend the ../ prefix.  This makes running things outside of the
  3181.  * source tree much easier.
  3182.  * $(ONESUBDIR)/Makefile exists as a separate, explicit target so that
  3183.  * clearmake will know what its goal is and do wink-in.
  3184.  */
  3185. #ifndef MakeMakeSubdirs
  3186. #define MakeMakeSubdirs(dirs,target)                    @@\
  3187. $(ONESUBDIR)/Makefile:                            @@\
  3188.     @MakeFlagsToShellFlags(n,executeit="no"); \            @@\
  3189.     cd $(ONESUBDIR) && \                        @@\
  3190.     if [ "$$executeit" != "no" ]; then \                @@\
  3191.         ImakeSubCmdHelper -DTOPDIR=$(IMAKETOP) -DCURDIR=$(ONECURDIR)$(ONESUBDIR); \ @@\
  3192.     fi;                                @@\
  3193.                                     @@\
  3194. target::                                @@\
  3195.     -@MakeFlagsToShellFlags(ik,set +e); \                @@\
  3196.     MakeFlagsToShellFlags(n,executeit="no"); \            @@\
  3197.     for i in dirs ;\                        @@\
  3198.     do \                                @@\
  3199.         case "$(CURRENT_DIR)" in \                @@\
  3200.         .) curdir= ;; \                        @@\
  3201.         *) curdir=$(CURRENT_DIR)/ ;; \                @@\
  3202.         esac; \                            @@\
  3203.         echo "making Makefiles in $$curdir$$i..."; \        @@\
  3204.         itmp=`echo $$i | sed -e 's;^\./;;g' -e 's;/\./;/;g'`; \    @@\
  3205.         curtmp="$(CURRENT_DIR)" \                @@\
  3206.         toptmp=""; \                        @@\
  3207.         case "$$itmp" in \                    @@\
  3208.             ../?*) \                        @@\
  3209.             while echo "$$itmp" | grep '^\.\./' > /dev/null;\    @@\
  3210.               do \                        @@\
  3211.                  toptmp="/`basename $$curtmp`$$toptmp"; \    @@\
  3212.                  curtmp="`dirname $$curtmp`"; \        @@\
  3213.                  itmp="`echo $$itmp | sed 's;\.\./;;'`"; \    @@\
  3214.               done \                    @@\
  3215.             ;; \                        @@\
  3216.         esac; \                            @@\
  3217.         case "$$itmp" in \                    @@\
  3218.         */?*/?*/?*/?*)    newtop=../../../../..;; \        @@\
  3219.         */?*/?*/?*)    newtop=../../../..;; \            @@\
  3220.         */?*/?*)    newtop=../../..;; \            @@\
  3221.         */?*)        newtop=../..;; \            @@\
  3222.         *)        newtop=..;; \                @@\
  3223.         esac; \                            @@\
  3224.         newtop="$$newtop$$toptmp"; \                @@\
  3225.         case "$(TOP)" in \                    @@\
  3226.         /?*) imaketop=$(TOP) \                    @@\
  3227.              imakeprefix= ;; \                    @@\
  3228.         .) imaketop=$$newtop \                    @@\
  3229.            imakeprefix=$$newtop/ ;; \                @@\
  3230.         *) imaketop=$$newtop/$(TOP) \                @@\
  3231.            imakeprefix=$$newtop/ ;; \                @@\
  3232.         esac; \                            @@\
  3233.         RemoveFile($$i/Makefile.bak); \                @@\
  3234.         if [ -f $$i/Makefile ]; then \                @@\
  3235.             echo "    $(MV) Makefile Makefile.bak"; \        @@\
  3236.             if [ "$$executeit" != "no" ]; then \        @@\
  3237.                 $(MV) $$i/Makefile $$i/Makefile.bak; \    @@\
  3238.             fi; \                        @@\
  3239.         fi; \                            @@\
  3240.         $(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=$$i ONECURDIR=$$curdir IMAKETOP=$$imaketop IMAKEPREFIX=$$imakeprefix $$i/Makefile; \    @@\
  3241.         if [ -d $$i ] ; then \                    @@\
  3242.             cd $$i; \                    @@\
  3243.             $(MAKE) $(MFLAGS) Makefiles; \            @@\
  3244.             cd $$newtop; \                    @@\
  3245.         else \                            @@\
  3246.             exit 1; \                    @@\
  3247.         fi; \                            @@\
  3248.     done
  3249.  
  3250. #ifdef UseInstalled
  3251. #define ImakeSubCmdHelper $(IMAKE_CMD)
  3252. #else
  3253. #define ImakeSubCmdHelper $(IMAKEPREFIX)$(IMAKE) -I$(IMAKEPREFIX)$(IRULESRC) \
  3254.               $(IMAKE_DEFINES) $(IMAKE_WARNINGS)
  3255. #endif
  3256.  
  3257. #endif /* MakeMakeSubdirs */
  3258.  
  3259.  
  3260. /*
  3261.  * MakefileSubdirs - generate rules to create Makefiles.
  3262.  */
  3263. #ifndef MakefileSubdirs
  3264. #define MakefileSubdirs(dirs)                        @@\
  3265. MakeMakeSubdirs(dirs,Makefiles)
  3266. #endif /* MakefileSubdirs */
  3267.  
  3268. /*
  3269.  * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
  3270.  * to cpp, because that trick does not work on all ANSI C preprocessors.
  3271.  * Delete line numbers from the cpp output (-P is not portable, I guess).
  3272.  * Allow XCOMM to be preceded by whitespace and provide a means of generating
  3273.  * output lines with trailing backslashes.
  3274.  * Allow XHASH to always be substituted, even in cases where XCOMM isn't.
  3275.  */
  3276. #ifndef CppSedMagic
  3277. #define CppSedMagic sed -e '/^#  *[0-9][0-9]*  *.*$$/d' \
  3278.             -e '/^#line  *[0-9][0-9]*  *.*$$/d' \
  3279.             -e '/^[     ]*XCOMM$$/s/XCOMM/#/' \
  3280.             -e '/^[     ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/#/' \
  3281.             -e '/^[     ]*XHASH/s/XHASH/#/' \
  3282.             -e '/\@\@$$/s/\@\@$$/\\/'
  3283. #endif /* CppSedMagic */
  3284.  
  3285. #ifndef CppFileTarget
  3286. #define CppFileTarget(dst,src,defs,deplist)                @@\
  3287. dst::  src deplist                            @@\
  3288.     RemoveFile($@)                            @@\
  3289.     ClearmakeOSName \
  3290.     $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@        @@\
  3291.                                     @@\
  3292. clean::                                    @@\
  3293.     RemoveFiles(dst)
  3294. #endif /* CppFileTarget */
  3295.  
  3296. /*
  3297.  * CppScriptTarget - generate rules to create a shell script by running the
  3298.  * input through cpp.  If the ExecableScripts configuration parameter is not
  3299.  * set, then make sure that the first line begins with a colon.
  3300.  */
  3301. #ifndef CppScriptTarget
  3302. #if ExecableScripts        /* can use #! instead of colon */
  3303. #define CppScriptTarget(dst,src,defs,deplist)                @@\
  3304. dst::    src deplist                            @@\
  3305.     RemoveFile($@)                            @@\
  3306.     ClearmakeOSName \
  3307.     $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@        @@\
  3308.     chmod a+x $@                            @@\
  3309.                                     @@\
  3310. clean::                                    @@\
  3311.     RemoveFiles(dst)
  3312. #else
  3313. #define CppScriptTarget(dst,src,defs,deplist)                @@\
  3314. dst::  src deplist                            @@\
  3315.     RemoveFile($@)                            @@\
  3316.     ClearmakeOSName \
  3317.     echo \: >$@                            @@\
  3318.     sed '1d' src | $(CPP) CppNoLineInfoOption defs | CppSedMagic >>$@    @@\
  3319.     chmod a+x $@                            @@\
  3320.                                     @@\
  3321. clean::                                    @@\
  3322.     RemoveFile(dst)
  3323. #endif /* ExecableScripts */
  3324. #endif /* CppScriptTarget */
  3325.  
  3326.  
  3327. /*
  3328.  * MakeScriptFromCpp - generate rules to create a script from a file with a
  3329.  * .cpp suffix.
  3330.  */
  3331. #ifndef MakeScriptFromCpp
  3332. #define MakeScriptFromCpp(name,defs)                    @@\
  3333. CppScriptTarget(name,name.cpp,defs,NullParameter)
  3334. #endif /* MakeScriptFromCpp */
  3335.  
  3336. #ifndef CppSourceFile
  3337. #define CppSourceFile(dst,src,defs,deplist)                @@\
  3338. CppFileTarget(dst,src,defs,deplist)                    @@\
  3339.                                     @@\
  3340. includes:: dst                                @@\
  3341.                                     @@\
  3342. depend:: dst
  3343. #endif /* CppSourceFile */
  3344.  
  3345. /* Like CppFileTarget, but don't add any default defines */
  3346. #ifndef CppRawFileTarget
  3347. #define CppRawFileTarget(dst,src,defs,deplist)                @@\
  3348. dst::  src deplist                            @@\
  3349.     RemoveFile($@)                            @@\
  3350.     ClearmakeOSName \
  3351.     $(RAWCPP) CppNoLineInfoOption defs <src | CppSedMagic >$@    @@\
  3352.                                     @@\
  3353. clean::                                    @@\
  3354.     RemoveFiles(dst)
  3355. #endif /* CppFileTarget */
  3356.  
  3357. /*
  3358.  * CppManTarget - preprocess man pages.  OS-specific man sections are replaced.
  3359.  */
  3360. #ifndef CppManTarget
  3361. #define CppManTarget(name,defs)                        @@\
  3362. AllTarget(name.$(MANNEWSUFFIX))                        @@\
  3363.                                     @@\
  3364. name.$(MANNEWSUFFIX): name.$(MANSRCSUFFIX)                @@\
  3365.     RemoveFile($@)                            @@\
  3366.     if test -z "$(PREPROCESSMANPAGES)" ; then \            @@\
  3367.        cd `dirname name` && \                    @@\
  3368.        $(LN) `basename name.$(MANSRCSUFFIX)` `basename $@`; \    @@\
  3369.     else \                                @@\
  3370.          ClearmakeOSName \
  3371.          $(RAWCPP) CppNoLineInfoOption $(MANDEFS) defs \        @@\
  3372.          < name.$(MANSRCSUFFIX) | CppSedMagic >$@; \        @@\
  3373.     fi                                @@\
  3374.                                     @@\
  3375. clean::                                    @@\
  3376.     RemoveFile(name.$(MANNEWSUFFIX))
  3377. #endif /* CppManTarget */
  3378.  
  3379. /*
  3380.  * MakeDirectories - generate rules to create a hierarchy of directories.
  3381.  */
  3382. #ifndef MakeDirectories
  3383. #define MakeDirectories(step,dirs)                    @@\
  3384. step::                                    @@\
  3385.     DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \        @@\
  3386.     for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \        @@\
  3387.         set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi; \ @@\
  3388.     done
  3389. #endif /* MakeDirectories */
  3390.  
  3391.  
  3392. /*
  3393.  * AllTarget - generate rules to build necessary things during make all.
  3394.  */
  3395. #ifndef AllTarget
  3396. #define AllTarget(depends)                        @@\
  3397. all:: depends
  3398. #endif /* AllTarget */
  3399.  
  3400. #ifdef DefineOldLibraryRules
  3401. #include <oldlib.rules>
  3402. #endif
  3403.  
  3404. #ifndef StaticLibrary
  3405. #define StaticLibrary(libpath,libname) Concat3(libpath,/,LibraryTargetName(libname))
  3406. #endif
  3407.  
  3408. /*
  3409.  * MakeMutex - generate mutex rules for parallel make
  3410.  */
  3411. #ifndef MakeMutex
  3412. #ifdef MutexDirective
  3413. #define MakeMutex(targets)                        @@\
  3414. MutexDirective:    targets
  3415. #endif /* MutexDirective */
  3416. #endif /* MakeMutex */
  3417.  
  3418. /*
  3419.  * Rules for dynamic modules.  These are primarily used by XFree86
  3420.  */
  3421.  
  3422. #ifndef LinkBuildModule
  3423. #ifdef UseInstalled
  3424. #define LinkBuildModule(module,subdir) $(_NULLCMD_)
  3425. #else
  3426. #define LinkBuildModule(module,subdir)\
  3427.     MakeDir($(BUILDMODULEDIR)/subdir)                @@\
  3428.     RemoveFile($(BUILDMODULEDIR)/subdir/module)            @@\
  3429.     @(UP="`$(REVPATH) subdir`"; set -x; \                @@\
  3430.       cd $(BUILDMODULEDIR)/subdir && \                @@\
  3431.         $(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module .)
  3432. #endif
  3433. #endif /* LinkBuildModule */
  3434.  
  3435. #ifndef LinkBuildNamedModule
  3436. #ifdef UseInstalled
  3437. #define LinkBuildNamedModule(module,name,subdir) $(_NULLCMD_)
  3438. #else
  3439. #define LinkBuildNamedModule(module,name,subdir)\
  3440.     MakeDir($(BUILDMODULEDIR)/subdir)                @@\
  3441.     RemoveFile($(BUILDMODULEDIR)/subdir/name)            @@\
  3442.     @(UP="`$(REVPATH) subdir`"; set -x; \                @@\
  3443.       cd $(BUILDMODULEDIR)/subdir && \                @@\
  3444.         $(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module name)
  3445. #endif
  3446. #endif /* LinkBuildNamedModule */
  3447.  
  3448. /*
  3449.  * ModuleObjectRule
  3450.  */
  3451. #ifndef ModuleObjectRule
  3452. #define ModuleObjectRule() NormalLibraryObjectRule()
  3453. #endif
  3454.  
  3455. /*
  3456.  * ObjectModuleTarget - build a module as a single object file
  3457.  */
  3458. #ifndef ObjectModuleTarget
  3459. #if MakeDllModules && DoLoadableServer
  3460. #define ObjectModuleTarget(module,objects)                @@\
  3461. DynamicModuleTarget(Concat(module,_drv.so), objects)
  3462. #else
  3463. #define ObjectModuleTarget(module,objects)                @@\
  3464. NormalRelocatableTarget(Concat(module,_drv), objects)
  3465. #endif
  3466. #endif
  3467.  
  3468. /*
  3469.  * LibraryModuleTarget
  3470.  */
  3471. #ifndef LibraryModuleTarget
  3472. #if MakeDllModules && DoLoadableServer
  3473. #define LibraryModuleTarget(module,objects)                @@\
  3474. NormalLibraryTarget(module, objects)                    @@\
  3475. DynamicModuleTarget(Concat3(lib,module,.so), objects)
  3476. #else
  3477. #define LibraryModuleTarget(module, objects)                @@\
  3478. NormalLibraryTarget(module, objects)
  3479. #endif
  3480. #endif
  3481.  
  3482. /*
  3483.  * DepLibraryModuleTarget
  3484.  */
  3485. #ifndef DepLibraryModuleTarget
  3486. #if MakeDllModules && DoLoadableServer
  3487. #define DepLibraryModuleTarget(module,deplist,objects)            @@\
  3488. NormalDepLibraryTarget(module, deplist, objects)            @@\
  3489. DepDynamicModuleTarget(Concat3(lib,module,.so), deplist, objects)
  3490. #else
  3491. #define DepLibraryModuleTarget(module,deplist,objects)            @@\
  3492. NormalDepLibraryTarget(module, deplist, objects)
  3493. #endif
  3494. #endif
  3495.  
  3496. #if defined(HardenedGccSpecs) && HardenedGccSpecs
  3497. LDBIND_FLAGS = -nonow
  3498. #endif
  3499.  
  3500. /*
  3501.  * DynamicModuleTarget - build a module to be dynamically loaded
  3502.  */
  3503. #ifndef DynamicModuleTarget
  3504. #define DynamicModuleTarget(module,modlist)                @@\
  3505. AllTarget(module)                            @@\
  3506.                                     @@\
  3507. module: modlist                                @@\
  3508.     RemoveFile($@)                            @@\
  3509.     $(CC) -o $@ $(SHLIBLDFLAGS) -nostdlib $(LDBIND_FLAGS) modlist    @@\
  3510.                                     @@\
  3511. clean::                                    @@\
  3512.     RemoveFile(module)
  3513. #endif /* DynamicModuleTarget */
  3514.  
  3515. /*
  3516.  * DepDynamicModuleTarget - build a module to be dynamically loaded
  3517.  */
  3518. #ifndef DepDynamicModuleTarget
  3519. #define DepDynamicModuleTarget(module,deplist,modlist)            @@\
  3520. AllTarget(module)                            @@\
  3521.                                     @@\
  3522. module: deplist                                @@\
  3523.     RemoveFile($@)                            @@\
  3524.     $(CC) -o $@ $(SHLIBLDFLAGS) -nostdlib $(LDBIND_FLAGS) modlist    @@\
  3525.                                     @@\
  3526. clean::                                    @@\
  3527.     RemoveFile(module)
  3528. #endif /* DepDynamicModuleTarget */
  3529.  
  3530. /*
  3531.  * InstallDynamicModule - install a dynamic module
  3532.  */
  3533. #ifndef InstallDynamicModule
  3534. #define InstallDynamicModule(module,dest,subdir)            @@\
  3535. AllTarget(module)                            @@\
  3536.     LinkBuildModule(module,subdir)                    @@\
  3537.                                     @@\
  3538. install:: module                            @@\
  3539.     MakeDir($(DESTDIR)dest/subdir)                    @@\
  3540.     $(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir
  3541. #endif
  3542.  
  3543. #ifndef InstallDynamicNamedModule
  3544. #define InstallDynamicNamedModule(module,instname,dest,subdir)        @@\
  3545. AllTarget(module)                            @@\
  3546.     LinkBuildNamedModule(module,instname,subdir)            @@\
  3547.                                     @@\
  3548. install:: module                            @@\
  3549.     MakeDir($(DESTDIR)dest/subdir)                    @@\
  3550.     $(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir/instname
  3551. #endif
  3552.  
  3553. #ifndef InstallObjectModule
  3554. #if !DoLoadableServer
  3555. #define InstallObjectModule(module,dest,subdir)    /**/
  3556. #else
  3557. #if MakeDllModules
  3558. #define InstallObjectModule(module,dest,subdir)                @@\
  3559. InstallDynamicModule(Concat(module,_drv.so),dest,subdir)
  3560. #else
  3561. #define InstallObjectModule(module,dest,subdir)                @@\
  3562. InstallDynamicModule(Concat(module,_drv.o),dest,subdir)
  3563. #endif
  3564. #endif
  3565. #endif
  3566.  
  3567. #ifndef InstallLibraryModule
  3568. #if !DoLoadableServer
  3569. #define InstallLibraryModule(module,dest,subdir)    /**/
  3570. #else
  3571. #if MakeDllModules
  3572. #define InstallLibraryModule(module,dest,subdir)            @@\
  3573. InstallDynamicModule(Concat3(lib,module,.so),dest,subdir)
  3574. #else
  3575. #define InstallLibraryModule(module,dest,subdir)            @@\
  3576. InstallDynamicModule(ModuleLibraryTargetName(module),dest,subdir)
  3577. #endif
  3578. #endif
  3579. #endif
  3580.  
  3581. #ifndef InstallModuleManPage
  3582. #define InstallModuleManPage(module)                    @@\
  3583. InstallGenManPage(module,$(DRIVERMANDIR),$(DRIVERMANSUFFIX))
  3584. #endif
  3585.  
  3586. #ifndef BuildObjectFromLibraryWithPath
  3587. #define BuildObjectFromLibraryWithPath(libpath,libname,objname)        @@\
  3588. AllTarget(objname.Osuf)                            @@\
  3589.                                     @@\
  3590. objname.Osuf: Concat3(libpath,/lib,libname.a)                @@\
  3591.     @$(MKDIRHIER) tmp                        @@\
  3592.     @$(CP) Concat3(libpath,/lib,libname.a) tmp            @@\
  3593.     @(cd tmp; set -x; ArExtCmd Concat(lib,libname.a); \        @@\
  3594.       $(LD) $(LDCOMBINEFLAGS) *.Osuf -o ../$@; \            @@\
  3595.       RemoveFiles(*.Osuf))                        @@\
  3596.     @$(RM) -r tmp                            @@\
  3597.                                     @@\
  3598. clean::                                    @@\
  3599.     RemoveFile(objname.Osuf)
  3600. #endif
  3601.  
  3602. #ifndef BuildObjectFromLibrary
  3603. #define BuildObjectFromLibrary(libname,objname) BuildObjectFromLibraryWithPath(.,libname,objname)
  3604. #endif
  3605.  
  3606. /*
  3607.  * LinkerRuntimeLibraryPathFlag - defined here to be a no-op for systems that
  3608.  * don't need it.   Overridden in system-specific config files for systems that
  3609.  * need it, usually with something like "Concat(-R,path)"
  3610.  */
  3611. #ifndef LinkerRuntimeLibraryPathFlag
  3612. # define LinkerRuntimeLibraryPathFlag(path)  /* */
  3613. #endif
  3614.  
  3615. /* Phony targets - GNU make has a feature to mark a target as phony,
  3616.  * which means that it wont consider that target to be the name of a
  3617.  * file.  In general this speeds up make, since it doesn't have to
  3618.  * look for those files when it sets out to create a phony target.
  3619.  * However, on cygwin, this is actually required for correct
  3620.  * operation, since the Win32 filesystems are case insensitive and the
  3621.  * install target conflicts with the INSTALL file present in some
  3622.  * (autotooled) directories.
  3623.  *
  3624.  * We probably don't need the #ifdef protection, since other make
  3625.  * implementations would just consider this a normal rule.  Better
  3626.  * safe than sorry, though.
  3627.  */
  3628. #if HasGnuMake
  3629. .PHONY: all interfaces install install.man install.lib install.sdk \
  3630.     depend includes clean
  3631. #endif
  3632.